コード例 #1
0
ファイル: Tab1.py プロジェクト: cttmayi/ScriptTool
 def onOpenFile(self):
     inst = misc.getInstance()
     inst.openFile(util.getCurPath() + 'Tabs\\th.jpg', 'jpg', None, ['C:\WINDOWS\system32\mspaint.exe'])
コード例 #2
0
ファイル: Tab1.py プロジェクト: cttmayi/ScriptTool
    def onCreate(self):
        #colors = ["red", "blue", "gray", "yellow", "green"]
        #self.SetBackgroundColour("gray")
        
        self.createStatic("Name:", 1, 1)
        self.createStatic("Name:", 2, 2)
        
        self.createButton("RunCmd", 8, 2, 15, self.OnClickRunCmd, eCbk = self.onShow)
        self.createButton("InputWait", 8, -1, 15, self.OnClickInputWait, eCbk = self.onShow)
        self.createButton("SendMessage", 8, -1, 15, self.onClickSendMessage, eCbk = self.onShow)
        self.createButton("Dialog", 8, -1, 15, self.onClickDialog, eCbk = self.onShow)
        self.createButton('OpenFile', 8, -1, 15, self.onOpenFile, eCbk = self.onShow)
        self.createButton("Log", 8, -1, 15, self.onClickLog, eCbk = self.onShow)
        self.createButton('Tree',8, -1, 15, self.onClickTree, eCbk = self.onShow)
        self.createButton('DirDialog',8, -1, 15, self.onFileDialog, eCbk = self.onShow)
        self.createButton('WriteExcel',8, -1, 15, self.onWriteExcel, eCbk = self.onShow)
        self.createButton('util.split',8, -1, 15, self.onUtilSplit, eCbk = self.onShow)
        self.createButton('timer start',8, -1, 15, self.onTimerStart, eCbk = self.onShow)
        self.createButton('timer stop',8, -1, 15, self.onTimerStop, eCbk = self.onShow)
        self.createButton('goto tab2',8, -1, 15, self.onGotoTab2, eCbk = self.onShow)
        self.createButton('util',8, -1, 15, self.onUtil, eCbk = self.onShow)
        self.btnSet = self.createButton('Button.reset', 8, -1, 15, self.btnReset, eCbk = self.onShow)
        self.createButton('trace',8, -1, 15, self.onTraceView, eCbk = self.onShow)
        self.createButton('enableButton',8, -1, 15, self.onEnableButton)
        self.createButton('setBitmap',8, -1, 15, self.onSetBitmap)
        self.createButton('startTask',8, -1, 15, self.onStartTask)
        
        
        self.tree = self.createTree(-1 , 2, 30, 10)
        root = self.tree.addItem(None, 'dataA', 'AB', 'C')
        self.item = self.tree.addItem(root, "dataB")
        
        print self.tree.getItemData(root)
        
        datas = ["1", '2', '3']
        datas_data = ["A","B", "C"]
        self.tree.addItems(self.item, datas, datas_data)
        
        #self.tree.deleteItem()
        
        #self.tree.setSelAction(self.OnSelChanged)
        self.tree.setExpandAction(self.onExpand)
        #self.tree.setRClickAction(self.onTreeRightClick)
        #self.tree.expandItem(root)
        #self.tree.expandTreeItem(item)
        #self.tree.deleteTreeItem(item)
        
        table = self.createTable(-1, 2, int(self.getDisplayWidth()/2), 10, ['A','B','C'])
        table.setColWidth(0, 30)
        table.setColWidth(1, 30)
        table.setColWidth(2, 50)
        table.insertItem(2, ['1','1'])
        table.insertItem(2, ['2','2'])
        table.insertItem(2, ['3','3'])
        table.insertItem(2, ['S','S'])
        table.insertItem(2, ['5','5'])
        table.insertItem(2, ['6','6'])
        table.setItemText(2, 0, 'A')
        
        #table.deleteItem()
        table.setRClickAction(self.onTreeRightClick)
        self.table = table

        
        button = self.createButton("A", -1, 2, 5, self.OnClick, 1)
        button.setEnable(False)
        button.setEnable(True)
        self.text = self.createEdit(-1, 2, 50, 10)
        self.text.setEnterAction(self.onEditEnter)
        self.text.setFilter('1234567890')
        
        #self.createGauge(-1, 2, 10)
        
        self.sel = self.createCombo(-1, 2, ["COM1","COM2"])
        self.sel.setSel(1)
        
        self.bmp = self.createBitmap(5,20,20,10)
        self.bmp.setBitmap('Tabs\\th.jpg')
        self.bmp.setLeftClickAction(self.onBitmapCbk)
        
        self.popupA = self.createPopupMenu('P')
        self.popupA.addItem("A", self.onPopupA_A)
        self.popupA.addItem("B", self.onPopupA_B, 'B')
        
        self.tree.setRClickPopup(self.popupA, 'expand')
        
        
        #self.popupB = self.createPopupMenu()
        #self.popupB.addItem("A", self.OnClick)
        #self.popupB.addItem("B", self.OnClick)
        #self.popupB.addItem("C", self.OnClick)
        
        #self.tree.setRClickAction(self.OnRClickB)
        
        self.cbok = self.createCheckbox(-1, 12, 20, ['A', 'B','C', 'D'], 4)
        self.cbok.setAction(self.onCheckbox)
        self.cbok.setSel(True, 0)
        self.cbok.setSel(True, 1)
        self.cbok.setSel(True, 2)
        self.cbok.setSel(True, 3)
        
        self.createRadiobox(-1, 12, 'Sel', ['ABCD','B']).setAction(self.onRadio)
        
        self.createEdit(-1, 12, 20, 2).setChangeAction(self.onCheckbox)
        ce = self.createComboEdit(-1, 12, 20, ['A', 'B'])
        ce.deleteItem(0)
        ce.addItem('C')
        
        t = self.createTab(-1, 12, 20, 10)
        #t.addEdit('Edit')
        #t.addTree('Tree')
        m = t.addTable('Table', ['A','B','C'])
        m.setColWidth(0, 80)
        m.setColWidth(1, 20)
        m.insertItem(0, ['1','1'])
        m = t.addTable('Table', ['A','B'])
        
        self.bmp2 = t.addBitmap('bitmap')
        self.bmp2.setBitmap(util.getCurPath() + 'Tabs\\th.jpg')
        t.setSel(1)
        
        self.bmp2.setLeftSlideAction(self.onBmpSlide)
        
        
        
        print self.getCfg('A')
        self.setCfg('A', 'b')
        
        
        #ce = self.createComboEdit(300, 10, 20, ['A', 'B'])
        
        #self.setFramePosition(400)
        
        self.enableShow = False
        
        
        minst = misc.getInstance()
        if minst.makeInstallTool('Make'):
            print 'pass'
        
        return