x.js 2.46 KB
Newer Older
Scott Sun's avatar
s  
Scott Sun committed
1
var plugin = require('topsin.gengui');
Scott Sun's avatar
s  
Scott Sun committed
2
var gui = plugin.newGui(plugin.__dirname);
Scott Sun's avatar
Scott Sun committed
3

Scott Sun's avatar
x  
Scott Sun committed
4 5 6 7 8 9 10
var headers = [
  {},
  { name: 'analysis_item', display: 'Analysis Item', resizeMode: 'ResizeToContents', displayRole: '$analysis_item' },
  { name: 'analysis_result', display: 'Analysis Result', resizeMode: 'ResizeToContents', displayRole: '$analysis_result' },
  { name: 'result', display: 'Result', resizeMode: 'ResizeToContents', displayRole: '$result' },
  { name: 'standard', display: 'Standard', resizeMode: 'ResizeToContents', displayRole: '$standard' },
  { name: 'remark', display: 'Remark', resizeMode: 'ResizeToContents', displayRole: '$remark', editRole: '$remark', flagsRole: 'ItemIsEditable|ItemIsEnabled|ItemIsSelectable' }
Scott Sun's avatar
s  
Scott Sun committed
11
];
Scott Sun's avatar
x  
Scott Sun committed
12 13 14 15
var item_list =  [
    { name: "male", icon: "male", text: "男", text_zhcn: "男", text_zhtw: "男" },
    { name: "female", icon: "female", text: "女", text_zhcn: "女", text_zhtw: "女" },
  ];
Scott Sun's avatar
Scott Sun committed
16
r = gui.showForm({
Scott Sun's avatar
x  
Scott Sun committed
17 18 19 20 21 22 23 24 25 26
  title: "BUG#10475",
  size: '600x400',
  items: {
    type: 'ScrollArea',
    property: { widget_resizable: true, frame_shape: 'NoFrame', align: 'Top' },
    child: {
      type: 'VBoxLayout',
      property: { margin: 2, spacing: 20, align: 'Top' },
      pack: { stretch: 0 },
      child: [
Scott Sun's avatar
s  
Scott Sun committed
27
        {
Scott Sun's avatar
x  
Scott Sun committed
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
          type: "FormGridLayout",
          property: { columns: 1, label_alignment: 'Top | Right', margin: 10, spacing: 20 },
          pack: { stretch: 0 },
          child: [
            {
              name: 'username',
              type: 'LineEdit',
              pack: { label: "用户名" },
              property: { enabled: true }
            },
            {
              name: 'password',
              type: 'LineEdit',
              pack: { label: "密码" },
              property: { echo_mode: "password" }
            },
            {
              name: 'sex',
              type: 'ComboBox',
              property: {
                enabled: true, item_list:item_list
              },
              pack: { label: '性别' }
            },
            {
              name: 'table',
              type: 'TableView',
              property: {},
              pack: { label: '性别' },
              initCallback: function (obj, self) {
                obj.setHeaderItem(headers);
                obj.setDataKeyList(["id", "analysis_item", "analysis_result", "result", "standard", "remark"]);
                obj.setPrimaryKey("id");
              }
Scott Sun's avatar
s  
Scott Sun committed
62
            }
Scott Sun's avatar
x  
Scott Sun committed
63
          ]
Scott Sun's avatar
s  
Scott Sun committed
64
        }
Scott Sun's avatar
x  
Scott Sun committed
65 66 67
      ]
    }
  }
Scott Sun's avatar
s  
Scott Sun committed
68 69
});

Scott Sun's avatar
x  
Scott Sun committed
70
print(JSON.stringify(r, null, '  '));