Esempio n. 1
0
 def onClose(self, event):
     self.timer.Stop()
     result = True
     if self.session_start_time != -1: # session is running
         result = show_msg(msg='Session is not stopped..\nUnsaved data will be lost. (Stop analysis or Cmd+S to save.)\nOkay to proceed to exit?', cancel_btn = True)
     if result == True:
         if self.cv_proc.video_rec != None: self.cv_proc.stop_video_rec()
         wx.FutureCall(500, self.Destroy)
    def showCollageInner(self):
        print "Showing collage from GUI"
        collageWindow = CollageFrame(self.collagePath)
        collageWindow.Show()

        #Show picture for 15 seconds and close down
        wx.FutureCall(15000, collageWindow.Destroy)
        print "Collage Displayed!"
Esempio n. 3
0
 def Show(self, arg=True):
     wx.Frame.Show(self, arg)
     self.SetClientSize(
         (self.GetClientSize()[0], self.GetClientSize()[1] + 1))
     self.SetClientSize(
         (self.GetClientSize()[0], self.GetClientSize()[1] - 1))
     self.Refresh()
     wx.FutureCall(500, self.GLPanel1.forceresize)
 def excelout(self, event):  #导出按钮1
     #try:
     if self.doyouwant == 1:
         repeat_i = "非法的用例主轮次或次轮次"
         self.showvalue(repeat_i)
     else:
         msg = 'output'
         # print "数据发送_标签"
         time_td = socket_data.sendmsg(self.ips, self.port, msg)  #发送&&接收
         #print time_td
         if time_td == 'fail':
             wx.FutureCall(1000, self.showfailbox)
         else:
             time_tds = time_td.replace(" ", "_")  #过滤文件名中空格
             self.doubletocsv_output(time_tds)
             self.savedialog(event, time_tds)
             wx.FutureCall(1000, self.showsusscebox)
Esempio n. 5
0
 def __init__(self, parent):
     global home
     self.parent = parent
     bmp = loader.load_bitmap(os.path.join(home, 'images', 'splash.png'))
     wx.SplashScreen.__init__(
         self, bmp, wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT, 5000,
         None, -1)
     self.fc = wx.FutureCall(100, self.ShowMain)
Esempio n. 6
0
 def __init__(self, parent):
     global home
     self.parent = parent
     bmp = wx.Image(os.path.join(home, 'images', 'splash.png'),
                    wx.BITMAP_TYPE_PNG).ConvertToBitmap()
     wx.SplashScreen.__init__(
         self, bmp, wx.SPLASH_CENTER_ON_SCREEN | wx.SPLASH_TIMEOUT, 2000,
         None, -1)
     self.fc = wx.FutureCall(100, self.MainWindow)
Esempio n. 7
0
 def __loop(self):
     if self.__continueLoop:
         wx.FutureCall(100, self.__loop)
     callbacks = self.__callbacksToCall
     args = self.__argsToPass
     self.__callbacksToCall = []
     self.__argsToPass = []
     for callback, args in zip(callbacks, args):
         callback(*args)
Esempio n. 8
0
 def __init__(self, app):
     self.app = app
     bmp = wx.Image(os.path.join(config.BitmapDir,
                                 "splash.png")).ConvertToBitmap()
     wx.SplashScreen.__init__(
         self, bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 2500,
         None, -1)
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.fc = wx.FutureCall(1500, app.ShowMain)
Esempio n. 9
0
    def Startup(self):
        # Importing takes sometime, therefore it will be done
        # while splash is being shown
        from invesalius.gui.frame import Frame
        from invesalius.control import Controller
        from invesalius.project import Project

        self.main = Frame(None)
        self.control = Controller(self.main)

        self.fc = wx.FutureCall(1, self.ShowMain)
        options, args = parse_comand_line()
        wx.FutureCall(1, use_cmd_optargs, options, args)

        # Check for updates
        from threading import Thread
        p = Thread(target=utils.UpdateCheck, args=())
        p.start()
Esempio n. 10
0
 def __init__(self):
     super(wxTestFrame, self).__init__(None)
     self.textnotif = 'not used'
     self.timer = wx.Timer(self, 1)
     self.timer.Start(200)
     self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
     wx.FutureCall(millis=100, callable=self.show_popup())
     self.Centre()
     self.Show()
Esempio n. 11
0
    def __init__(
            self, parent, ID=-1, title='Option Panel', pos=wx.DefaultPosition,
        size=(640,480), style=wx.DEFAULT_FRAME_STYLE
            ):

        wx.Frame.__init__(self, parent, ID, title, pos, size, style)
        
        self.temp_userconfig = CopyDict(userConfig)
        self.temp_customuserconfig = CopyDict(customUserConfig)


        pp = wx.Panel(self, -1)
        self.optpane = wx.Treebook(pp, -1, style= wx.BK_DEFAULT)

        # These are the default panels laying in a tree-like fashion
        optList = [['Files and Folders'], ['Sleep options'],['Video options'], ['Graphs', 'Style', 'Colours'], ['Custom Panels Options'], ['Information']]

        # Here we add to position two of the list, under Custom Panels Option, every needed customPanel
        for panName in self.temp_customuserconfig:
            optList[3].append(panName)

        # Now make a bunch of panels for the list book
        for optCategory in optList:
            # The first item of the list is the main Panel
            tbPanel = self.makePanel(self.optpane, optCategory[0])
            self.optpane.AddPage(tbPanel, optCategory[0])

            for optName in optCategory[1:]:
                # All the following ones are children
                tbPanel = self.makePanel(self.optpane, optName)
                self.optpane.AddSubPage(tbPanel, optName)

        #self.Bind(wx.EVT_TREEBOOK_PAGE_CHANGED, self.OnPageChanged)

        btSave = wx.Button(pp, wx.ID_SAVE)
        btCancel = wx.Button(pp, wx.ID_CANCEL)
        btSave.Bind(wx.EVT_BUTTON, self.OnSaveOptions)
        btCancel.Bind(wx.EVT_BUTTON, self.OnCancelOptions)
        self.Bind(wx.EVT_CLOSE, self.OnCancelOptions)


        btSz = wx.BoxSizer(wx.HORIZONTAL)
        btSz.Add (btCancel)
        btSz.Add (btSave)

        sz = wx.BoxSizer(wx.VERTICAL)
        sz.Add (self.optpane, 1, wx.EXPAND)
        sz.Add (btSz, 0, wx.ALIGN_RIGHT | wx.ALL, 10)

        pp.SetSizer(sz)

        # This is a workaround for a sizing bug on Mac...
        wx.FutureCall(100, self.AdjustSize)


        for i in range(0,len(self.optpane.Children)-1):
            self.optpane.ExpandNode(i)
Esempio n. 12
0
 def __init__(self,basedir):
     path = os.path.join(basedir,"Images")
     image = os.path.join(path,"scyther-splash.png")
     bmp = wx.Image(image).ConvertToBitmap()
     wx.SplashScreen.__init__(self, bmp,
                              wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                              5000, None, -1)
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.fc = wx.FutureCall(2000, self.ShowMain)
 def  timestatistics(self,event):#统计按照时间执行的STEP
     try:
         if self.doyouwant == 1:
             repeat_i = "非法的用例主轮次或次轮次"
             self.showvalue(repeat_i)     
         else:
             msg = 'output_picture'
             time_td =  socket_data.sendmsg(self.ips, self.port, msg) #发送&&接收
             if time_td == 'fail':
                 wx.FutureCall(1000,self.showfailbox) 
             else:
                 time_tds = time_td.replace(" ","_")                                 #过滤文件名中空格
                 self.doubletocsv(time_tds)
                 self.savedialog(event,time_tds)
                 self.excel_charts_out(self.pathdst_cvs_excel, self.excel_arrw)        #输出做好的excel图形文件
                 wx.FutureCall(1000,self.showsusscebox) 
     except:
         wx.FutureCall(1000,self.showfailbox) 
Esempio n. 14
0
 def _copy_to_clipboard(self, text, duration=None):
     if not wx.TheClipboard.Open():
         raise RuntimeError(_("Could not open clipboard"))
     try:
         clip_object = wx.TextDataObject(text)
         wx.TheClipboard.SetData(clip_object)
         if duration:
             wx.FutureCall(duration * 1000, self._clear_clipboard, text)
     finally:
         wx.TheClipboard.Close()
Esempio n. 15
0
 def __init__(self):
     splash_fname = osp.join(osp.dirname(__file__), u'splash.png')
     image = wx.Image(splash_fname, wx.BITMAP_TYPE_PNG)
     bmp = image.ConvertToBitmap()
     self.bmp = image.Resize((200, 200), (0, 0)).ConvertToBitmap()
     wx.SplashScreen.__init__(
         self, bmp, wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT, 5000,
         None, -1)
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.fc = wx.FutureCall(2000, self.ShowMain)
Esempio n. 16
0
    def __init__(self, parent, id,callback=None,customizableFields=None, customizedFields=None, proceduresPersonalizations=None,removalOptions=None):
        
        wx.Treebook.__init__(self, parent, id, style=wx.BK_DEFAULT)
        idGenerator=self.getNextID(50)
        self.callback=callback
        #self.callback_treatmnt=callback_treatmnt
        self.cal={}
        self.cal_treatmnt={}
        self.cal_cancel={}
        self.cal_preliev={}

        #Composition list element for each page in funtion TreeB_element
        #initilization listCrt in each pages
        self.init_lstCrt={}
        self.dic_custm={}
        self.dic_custm_val={}
        self.lischk=[]
        #self.liscan=[]
        self.dico_cs_lab={}
        self.dico_prova={}

        self.dico_prova=self.datbase_elemt(customizedFields)
                    
        # return dico_data_tre,dic_pag_nam,dico_db_data
        TreeB_element,self.dico_cs_lab,self.dico_DB_val=self.getPageList(customizableFields, customizedFields, proceduresPersonalizations,removalOptions)
       
        for el in self.dico_cs_lab:
            for k in self.dico_cs_lab[el]:
                self.init_lstCrt[k]=''
        self.dic_custm=copy.copy(self.dico_DB_val)
        
        #creat the the tree with the pages 
        for k,v in TreeB_element.items():
            from mainlogic import _
            # Parent page
            # win=self.make_Tree_Panel(k,'papa')
            if k=='core':
                win=self.make_Tree_Panel(k,'papa')
                self.AddPage(win,'%s                                              '%_(k).upper(),imageId=idGenerator.next())
                #creat the tree son child branch and pages
            
                #Solo la personalizzazine del CODE
                if v!=[]:
                    for sub in v:
                        for cle,elm in sub.items():
                            if cle !='':
                                if cle in self.dico_DB_val.keys():
                                    win=self.make_Tree_Panel(cle,'sottopagina',elm,self.dico_DB_val)
                                else:
                                    win=self.make_Tree_Panel(cle,'sottopagina',elm)
                                   
                                self.AddSubPage(win,_(cle),imageId=idGenerator.next())
        self.GetTreeCtrl().ExpandAll()    
            # This is a workaround for a sizing bug on Mac
        wx.FutureCall(100, self.AdjustSize)
Esempio n. 17
0
 def continueToGame(self, event):
     wx.FutureCall(1, self.drawBackground)
     self.welcomeDisplay.Hide()
     self.continueButton.Hide()
     self.welcome.Hide()
     self.exitButton.Hide()
     self.questionText = myText(self.Canvas,
                                label=self.question,
                                pos=(0, APP_SIZE_Y / 6),
                                size=(APP_SIZE_X, APP_SIZE_Y / 30),
                                style=wx.ALIGN_CENTRE_HORIZONTAL,
                                name="questionText")
     #GAME SCREEN
     #Define Buttons
     self.noButton = goldButton(
         self.Canvas,
         label="No",
         pos=((APP_SIZE_X / 2) - (BUTTON_SIZE_X * 11 / 10),
              APP_SIZE_Y - (BUTTON_SIZE_Y * 10 / 3)),
         size=(BUTTON_SIZE_X, BUTTON_SIZE_Y),
         style=wx.BORDER_NONE)
     self.yesButton = goldButton(
         self.Canvas,
         label="Yes",
         pos=((APP_SIZE_X / 2) - (BUTTON_SIZE_X * 11 / 10),
              APP_SIZE_Y - (BUTTON_SIZE_Y * 14 / 3)),
         size=(BUTTON_SIZE_X, BUTTON_SIZE_Y),
         style=wx.BORDER_NONE)
     self.dnaButton = goldButton(
         self.Canvas,
         label="Does Not Apply",
         pos=((APP_SIZE_X / 2) - (BUTTON_SIZE_X / 2),
              APP_SIZE_Y - (BUTTON_SIZE_Y * 6 / 3)),
         size=(BUTTON_SIZE_X, BUTTON_SIZE_Y),
         style=wx.BORDER_NONE)
     self.probablyButton = goldButton(
         self.Canvas,
         label="Probably",
         pos=((APP_SIZE_X / 2) + (BUTTON_SIZE_X * 1 / 10),
              APP_SIZE_Y - (BUTTON_SIZE_Y * 14 / 3)),
         size=(BUTTON_SIZE_X, BUTTON_SIZE_Y),
         style=wx.BORDER_NONE)
     self.probablyNotButton = goldButton(
         self.Canvas,
         label="Probably Not",
         pos=((APP_SIZE_X / 2) + (BUTTON_SIZE_X * 1 / 10),
              APP_SIZE_Y - (BUTTON_SIZE_Y * 10 / 3)),
         size=(BUTTON_SIZE_X, BUTTON_SIZE_Y),
         style=wx.BORDER_NONE)
     #Bind Events
     self.Bind(wx.EVT_BUTTON, self.isNo, self.noButton)
     self.Bind(wx.EVT_BUTTON, self.isYes, self.yesButton)
     self.Bind(wx.EVT_BUTTON, self.doesNotApply, self.dnaButton)
     self.Bind(wx.EVT_BUTTON, self.probably, self.probablyButton)
     self.Bind(wx.EVT_BUTTON, self.probablyNot, self.probablyNotButton)
Esempio n. 18
0
    def forward_radio_packet(self, link):
        if link in self.link_dict:
            l = self.link_dict[link]
            l.flashcount += 1
            # Return the link to its original color after a delay.
            wx.FutureCall(500, self.flash_link_off, l, link)

            dc = wx.ClientDC(self)
            l.Draw(dc)
            l.src.Draw(dc)
            l.dst.Draw(dc)
Esempio n. 19
0
    def showCollageInner(self):
        print("showCollageInner - 8 Memory usage: %s (kb)" % resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
        print("Showing collage from GUI")
        collageWindow = collage.CollageFrame(self.collagePath)
        collageWindow.Show()

        #Show picture for 15 seconds and close down
        wx.FutureCall(15000, collageWindow.Destroy)
        print("Collage Displayed!")
        gc.collect()
        print("showCollageInner - 9 Memory usage: %s (kb)" % resource.getrusage(resource.RUSAGE_SELF).ru_maxrss)
Esempio n. 20
0
 def __init__(self):
     bmp = Icones.getLogoSplashBitmap()
     wx.SplashScreen.__init__(self,
                              bmp,
                              wx.SPLASH_CENTRE_ON_SCREEN
                              | wx.SPLASH_TIMEOUT,
                              5000,
                              None,
                              -1,
                              style=wx.BORDER_NONE | wx.FRAME_NO_TASKBAR)
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.fc = wx.FutureCall(2000, self.ShowMain)
Esempio n. 21
0
 def excelout(self, event):  #导出按钮1
     #try:
     if self.doyouwant == 1:
         repeat_i = "非法的用例主轮次或次轮次"
         self.showvalue(repeat_i)
     else:
         select = self.choice_rule.GetSelection()
         msg = ['output']
         if select == 0:
             msg.append('rule_1')
         elif select == 1:
             msg.append('rule_2')
         strmsg = socket_data.listtostring(msg)
         time_td = socket_data.sendmsg(self.ips, self.port, strmsg)  #发送&&接收
         if time_td == 'fail':
             wx.FutureCall(1000, self.showfailbox)
         else:
             time_tds = time_td.replace(" ", "_")  #过滤文件名中空格
             self.doubletocsv_output(time_tds)
             self.savedialog(event, time_tds)
             wx.FutureCall(1000, self.showsusscebox)
Esempio n. 22
0
    def onCompile(self, event):
        self.onSave(event=None)
        self.parent.hideMsg()
        if self.path == '':
            return

        check = pycheck.PyCheck()
        check.check(self.parent.cfg['nxtemudir'] + "/api.py")
        try:
            check.check(self.path)
        except NameError as nr:
            msg = "NameError: %s on line %d" % nr.args
            self.editor.GotoLine(nr.args[1] - 1)
            self.parent.showMsg(msg)

            return False

        except SyntaxError as se:
            msg = "SyntaxError: %s \n\t on line %d" % \
                (se.args[0], se.args[1][1])

            pos = self.editor.GetLineEndPosition(se.args[1][1] - 2)
            pos += se.args[1][2]

            self.editor.GotoPos(pos)
            self.parent.showMsg(msg)

            return False

        except ValueError as ve:
            msg = "ValueError: %s on line %d" % ve.args[:2]
            self.editor.GotoLine(ve.args[1] - 1)
            # pos = self.editor.GetLineEndPosition(ve.args[3])

            self.editor.SetSelection(ve.args[2][0], ve.args[2][1])
            self.parent.showMsg(msg)

            return False

        self.parent.statusbar.SetStatusText("Compiled...OK")

        wx.FutureCall(2000, self.clearStatusbar)

        f = open(
            "%s/__progs__/e%s" % (self.parent.cfg["nxtemudir"], self.filename),
            "w")

        f.write("from api import *\n")
        f.write(
            pycheck.defFix(pycheck.loopFix(self.editor.GetText(), "ticker()")))
        f.close()

        return True
Esempio n. 23
0
 def __init__(self, parent):
     wx.Window.__init__(self, parent)
     
     self.Bind(wx.EVT_PAINT, self.OnPaint)
     
     self.timer = wx.Timer(self)#创建定时器
     self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)#绑定一个定时器事件
     self.timer.Start(1000)#设定时间间隔
     
     #wx.FutureCall(1000, self.fcall, 'call after 100ms', name="test")
     #wx.CallAfter(self.fcall, 1, 'abc', name="ccc", help="test")
     wx.FutureCall(1000*2,self.shutdown)
Esempio n. 24
0
 def __init__(self):
     gif = image(IMAGE_DEBUGGER)
     wx.SplashScreen.__init__(
         self,
         gif,
         wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
         5000,
         None,
         -1,
     )
     self.Bind(wx.EVT_CLOSE, self.OnClose)
     self.fc = wx.FutureCall(2000, self.ShowMain)
Esempio n. 25
0
 def statistics(self, event):  #统计次数按钮
     msg = "statistics"
     if self.doyouwant == 1:
         repeat_i = "非法的用例主轮次或次轮次"
         self.showvalue(repeat_i)
     else:
         time_td = socket_data.sendmsg(self.ips, self.port, msg)  #发送&&接收
         if time_td == "fail":
             value = "获取用例次数失败!"
             wx.FutureCall(1000, self.showstatfail)
         else:
             repeat = '重复执行的用例数为%s条' % time_td
             wx.MessageBox(repeat, 'Info', wx.OK | wx.ICON_INFORMATION)
Esempio n. 26
0
 def DeleteItem(self, index, fadeStep=10, fadeSpeed=50):
     if self.IsEnabled():
         self.__startDeleteItem(index)
     fgColour, bgColour, transparentColour = self.__getColours(index)
     if fgColour == bgColour == transparentColour:
         self.__finishDeleteItem(index)
     else:
         for colour, setColour in [(fgColour, self.SetItemTextColour), 
                                   (bgColour, self.SetItemBackgroundColour)]:
             fadedColour = self.__fadeColour(colour, transparentColour, 
                                             fadeStep)
             setColour(index, fadedColour)
         wx.FutureCall(50, self.DeleteItem, index, fadeStep, fadeSpeed)
Esempio n. 27
0
 def OnButton(self, evt):
     e_id = evt.GetId()
     if e_id == wx.ID_CLOSE:
         self.Close()
     elif e_id == self.ID_SEND:
         self.mailto(AUTOR_EMAIL, "Informe de Error", self.err_msg)
         self.Close()
     elif e_id == wx.ID_ABORT:
         ErrorDialog.ABORT = True
         wx.FutureCall(500, wx.GetApp().OnExit)
         self.Close()
     else:
         evt.Skip()
Esempio n. 28
0
def fixup_osx():
    # ***Hack***
    # On OSX, when launched by Finder, app starts, but instance remains
    # invisible. Re-launching the app will make the 1st instance visible.
    # argv[0] expected to be: 
    #   '/Applications/ConeDevelopment.app/Contents/Resources/ConeDevelopment.py'
    POSTFIX = "/Contents/Resources/ConeDevelopment.py"
    argv0 = sys.argv[0]
    if argv0.endswith(POSTFIX):
        osx_app_path = argv0[:-len(POSTFIX)]
        def deferred_run():
            subprocess.call(["open", osx_app_path])
        wx.FutureCall(2500, deferred_run)
Esempio n. 29
0
    def __init__(self):
        bmp = GetSplashBitmap()
        SplashScreen.__init__(self,
                              None,
                              bitmapfile=bmp,
                              style=wx.FRAME_SHAPED
                              | wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                              duration=2000,
                              callback=None,
                              ID=-1)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.fc = wx.FutureCall(10, self.ShowMain)
Esempio n. 30
0
    def LoadVideo(self, path):
        self.app.userprofile['HEGMovie_video'] = path
        if not hasattr(self, 'mc'):
            self.InitMediaCtrl()
        if DEBUG: print "Loading %s" % path
        if not os.path.exists(path) and os.path.exists(opj(mediadir, path)):
            path = opj(mediadir, path)
        elif not os.path.exists(path) and not (path.startswith('dvd')
                                               and '://' in path):
            if DEBUG: print "That path doesn't seem to exist."
            return True
        self.loaded = False
        if DEBUG: print "Trying to load %s" % path
        if not self.mc.Load(path):
            wx.MessageBox("Unable to load %s: Unsupported format?" % path,
                          "ERROR", wx.ICON_ERROR | wx.OK)
            return True

        if 'HEGMovie_moviePositions' in self.app.userprofile and \
            self.app.userprofile['HEGMovie_video'] in \
            self.app.userprofile['HEGMovie_moviePositions']:
            t = self.app.userprofile['HEGMovie_moviePositions']\
                      [self.app.userprofile['HEGMovie_video']]
            if t > 95.: t = 0
            if DEBUG: print "Seeking to %3.1f" % t
            #self.mc.Seek(t, 1)

        self.mc.SetInitialSize()

        if not self.mc.paused:
            self.mc.paused = True
            self.mc.pausing = True
            self.mc.Pause()

        wx.FutureCall(500, self.OnResize, self)
        wx.FutureCall(1500, self.OnResize, self)
        wx.FutureCall(4500, self.OnResize, self)
        return False