コード例 #1
0
	def __init__(self, parent):
		wx.StatusBar.__init__(self, parent, -1)

		self.pulsing = False
		self.percent = 0
		
		# This status bar has three fields
		self.SetFieldsCount(2)
		# Sets the three fields to be relative widths to each other.
		self.SetStatusWidths([-4, -1])
		self.sizeChanged = False
		self.Bind(wx.EVT_SIZE, self.OnSize)
		self.Bind(wx.EVT_IDLE, self.OnIdle)

		# Field 0 ... just text
		self.SetStatusText("Ready", 0)

		# This will fall into field 1 (the second field)
		self.gauge = wx.Gauge(self, wx.ID_ANY, 100, wx.DefaultPosition, wx.DefaultSize)

		# set the initial position of the checkbox
		self.Reposition()

		# We're going to use a timer to drive a 'clock' in the last field.
		self.timer = wx.PyTimer(self.Notify)
コード例 #2
0
ファイル: stripcharting.py プロジェクト: govtmirror/wxmpl
    def OnInit(self):
        self.timer = wx.PyTimer(self.OnTimer)
        self.numPoints = 0

        self.frame = wxmpl.PlotFrame(None, -1, 'WxMpl Stripchart Demo')
        self.frame.Show(True)

        # The data to plot
        x = arange(0.0, 200, 0.1)
        y1 = 4 * cos(2 * pi *
                     (x - 1) / 5.7) / (6 + x) + 2 * sin(2 * pi *
                                                        (x - 1) / 2.2) / (10)
        y2 = y1 + .5
        y3 = y2 + .5
        y4 = y3 + .5

        # Fetch and setup the axes
        axes = self.frame.get_figure().gca()
        axes.set_title('Stripchart Test')
        axes.set_xlabel('t')
        axes.set_ylabel('f(t)')

        # Attach the StripCharter and define its channels
        self.charter = wxmpl.StripCharter(axes)
        self.charter.setChannels([
            TestChannel('ch1', x, y1),
            TestChannel('ch2', x, y2),
            TestChannel('ch3', x, y3),
            TestChannel('ch4', x, y4)
        ])

        # Prime the pump and start the timer
        self.charter.update()
        self.timer.Start(100)
        return True
コード例 #3
0
ファイル: main.py プロジェクト: daniyuu/pythonGo
    def __init__(self,parent,id,title):
        self.dirname=''
        wx.Frame.__init__(self, parent, -1, title, size = (600+5,537+46),
                          style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)

#        self.SetSizeHints(600,537)
        self.CentreOnScreen()
        self.SetMaxSize([600+5,537+46])
        #---------------------------------------------------------------------------
        #定义和初始化一些全局的变量
        self.InitValues()
        #---------------------------------------------------------------------------
        #建立菜单
        self.BuildMenu()
        #---------------------------------------------------------------------------
        #建立定时器
        self.timer = wx.PyTimer(self.Notify)
        self.timer.Start(200)
        self.Notify()
        #---------------------------------------------------------------------------
        #消息绑定
        self.Bind(wx.EVT_MENU, self.OnNew, id=ID_NEW)
        self.Bind(wx.EVT_MENU, self.OnAbout, id=ID_HELP_ABOUT)
        self.Bind(wx.EVT_MENU, self.OnExit, id=ID_EXIT)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLButtonDown)

        self.Show(1)
コード例 #4
0
 def __init__(self, parent):
     wx.StatusBar.__init__(self, parent, -1)
     self.SetFieldsCount(2)
     self.SetStatusWidths([-3, -1])
     self.timer = wx.PyTimer(self.notify)
     self.timer.Start(1000)
     self.notify()
コード例 #5
0
def connectConsole(obj):
    global consoleObject, consoleOutputHandle, checkDeadTimer
    #Get the process ID of the console this NVDAObject is fore
    processID, threadID = winUser.getWindowThreadProcessID(obj.windowHandle)
    #Attach NVDA to this console so we can access its text etc
    try:
        wincon.AttachConsole(processID)
    except WindowsError as e:
        log.debugWarning("Could not attach console: %s" % e)
        return False
    wincon.SetConsoleCtrlHandler(_consoleCtrlHandler, True)
    consoleOutputHandle = winKernel.CreateFile(
        u"CONOUT$", winKernel.GENERIC_READ | winKernel.GENERIC_WRITE,
        winKernel.FILE_SHARE_READ | winKernel.FILE_SHARE_WRITE, None,
        winKernel.OPEN_EXISTING, 0, None)
    #Register this callback with all the win events we need, storing the given handles for removal later
    for eventID in (winUser.EVENT_CONSOLE_CARET,
                    winUser.EVENT_CONSOLE_UPDATE_REGION,
                    winUser.EVENT_CONSOLE_UPDATE_SIMPLE,
                    winUser.EVENT_CONSOLE_UPDATE_SCROLL,
                    winUser.EVENT_CONSOLE_LAYOUT):
        handle = winUser.setWinEventHook(eventID, eventID, 0,
                                         consoleWinEventHook, 0, 0, 0)
        if not handle:
            raise OSError("could not register eventID %s" % eventID)
        consoleWinEventHookHandles.append(handle)
    consoleObject = obj
    checkDeadTimer = wx.PyTimer(_checkDead)
    checkDeadTimer.Start(CHECK_DEAD_INTERVAL)
    return True
コード例 #6
0
ファイル: HeartInfoPanel.py プロジェクト: yesnoandor/mech
    def __init__(self, *args, **kwargs):
        super(HeartInfoPanel, self).__init__(*args, **kwargs)

        # 创建画图板和画图区,重新设置了图形的大小
        self.figure = matplotlib.figure.Figure(figsize=(7.7, 3.4))
        self.axes = self.figure.add_axes([0.1, 0.1, 0.8, 0.8])

        # 去掉X轴,Y轴坐标
        self.axes.get_xaxis().set_visible(False)
        self.axes.get_yaxis().set_visible(False)

        # 去掉对应的边框
        for key, spine in self.axes.spines.items():
            # 'left', 'right', 'bottom', 'top'
            if key == 'right' or key == 'top':
                spine.set_visible(False)

        self.FigureCanvas = FigureCanvas(self, -1, self.figure)

        self.heart_mode = False
        self.x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
        self.y = np.zeros(40, dtype=float)
        # self.y = np.array([0, 0, 0, 0.5, 0, -0.5, -1, 0, 1, 0.5, 0, -0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0, -0.5, -1, 0, 1, 0.5, 0, -0.5, 0, 0, 0, 0, 0, 0, 0, 0])
        self.plot(self.x, self.y)

        # 订阅消息
        pub.subscribe(self.OnHeartBeatEvent, 'heart_beat_event')

        # 增加定时器,更新UI状态
        self._update_ui = wx.PyTimer(self.UpdateUI)
        self._update_ui.Start(1000)
        self._timeout = 0
        self._timeout_threhold = 5
コード例 #7
0
 def __init__(self):
     wx.Frame.__init__(self, None, -1, size=(320, 100))
     panel = wx.Panel(self, -1)
     sb = self.CreateStatusBar(2)
     sb.SetStatusWidths([100, 220])
     self.count = 0
     self.timer = wx.PyTimer(self.Notify)  # 创建定时器
     self.timer.Start(1000)  # 设置间隔时间
     self.inputText = wx.TextCtrl(panel,
                                  -1,
                                  "",
                                  pos=(10, 10),
                                  size=(50, -1))
     self.inputText2 = wx.TextCtrl(panel,
                                   -1,
                                   "",
                                   pos=(10, 10),
                                   size=(50, -1))
     btn = wx.Button(panel, -1, u"带参数的定时器")
     btn2 = wx.Button(panel, -1, u"停止")
     self.Bind(wx.EVT_BUTTON, self.OnStart, btn)
     self.Bind(wx.EVT_BUTTON, self.OnStop, btn2)
     sizer = wx.FlexGridSizer(cols=4, hgap=10, vgap=10)
     sizer.Add(self.inputText)
     sizer.Add(self.inputText2)
     sizer.Add(btn)
     sizer.Add(btn2)
     panel.SetSizer(sizer)
     panel.Fit()
コード例 #8
0
 def __init__(self, bmp, timeout=5000):
     wx.Frame.__init__(self, None, style=wx.FRAME_NO_TASKBAR)
     self.border = 2
     self.SetBackgroundColour(wx.WHITE)
     sizer = wx.BoxSizer(wx.VERTICAL)
     self.bmp = GenStaticBitmap(self, -1, bmp)
     sizer.Add(self.bmp, 0, wx.EXPAND)
     self.label = wx.StaticText(self, -1, "Loading...")
     self.label.SetBackgroundColour(wx.WHITE)
     sizer.Add(self.label, 0, flag=wx.EXPAND | wx.ALL, border=self.border)
     self.progressHeight = 12
     self.gauge = wx.Gauge(self,
                           -1,
                           range=100,
                           size=(-1, self.progressHeight),
                           style=wx.GA_HORIZONTAL | wx.GA_SMOOTH)
     self.gauge.SetBackgroundColour(wx.WHITE)
     self.gauge.SetForegroundColour(wx.RED)
     sizer.Add(self.gauge, 0, flag=wx.EXPAND | wx.ALL, border=self.border)
     self.CenterOnScreen()
     self.timeout = timeout
     self._splashtimer = wx.PyTimer(self.OnNotify)
     self._splashtimer.Start(self.timeout)
     self.count = 0
     self.visible = True
     self.SetSizer(sizer)
     sizer.Fit(self)
     self.bmp.Layout()
     self.label.Layout()
     self.gauge.Layout()
     self.Layout()
     self.Update()
     wx.Yield()
コード例 #9
0
    def OnNCHitTest(self, hWnd, msg, wParam, lParam):
        'Win32 message event for "hit test" mouse events on a window.'

        if self.Enabled and self.motiontrigger:
            # The mouse has hit the one pixel window--bring the window back.


            ms = wx.GetMouseState()
            if ms.LeftDown():
                self.bypassSizeEvents = True
            elif self.bypassSizeEvents:
                self.bypassSizeEvents = False

            try:
                t = self.autohidden_timer
            except AttributeError:
                t = self.autohidden_timer = wx.PyTimer(self.autohidden_mouseover)

            if not t.IsRunning():
                t.StartOneShot(self.RevealDurationMs)

        elif self.Enabled and self.docked:
            # Don't allow the window's edge to be dragged if that edge is the
            # one at the edge of the screen.
            hit = DefWindowProc(hWnd, msg, wParam, lParam)
            if self.side == ABE_LEFT  and hit in (HTLEFT,  HTTOPLEFT,  HTBOTTOMLEFT) or \
               self.side == ABE_RIGHT and hit in (HTRIGHT, HTTOPRIGHT, HTBOTTOMRIGHT):
                return False
コード例 #10
0
ファイル: umenu.py プロジェクト: sgricci/digsby
    def __init__(self, parent, menu):
        SkinVListBox.__init__(self,
                              parent,
                              style=wx.NO_BORDER | wx.FULL_REPAINT_ON_RESIZE
                              | wx.WANTS_CHARS)

        self.menu = menu
        self.UpdateSkin()

        self.timer = wx.PyTimer(self._on_submenu_timer)

        Bind = self.Bind
        Bind(wx.EVT_MOUSE_EVENTS, self._mouseevents)
        Bind(wx.EVT_MOUSE_CAPTURE_CHANGED, self._capturechanged)
        Bind(wx.EVT_LISTBOX, self._listbox)
        Bind(wx.EVT_KEY_DOWN, self._keydown)

        self.mouseCallbacks = {
            wx.wxEVT_MOTION: self._motion,
            wx.wxEVT_RIGHT_DOWN: self._rdown,
            wx.wxEVT_LEFT_DOWN: self._ldown,
            wx.wxEVT_LEFT_UP: self._lup
        }

        MenuListBox._lastvlist = ref(self)
コード例 #11
0
def main():
    a = wx.PySimpleApp()

    threads = []
    for x in xrange(50):
        bg = BgThread()
        bg.setDaemon(True)
        bg.start()
        threads.append(bg)

    f = wx.Frame(None)
    b = wx.Button(f, -1, 'button')

    def on_button(e=None):
        random.choice(threads).q.put(wx.EvtHandler())

    b.Bind(wx.EVT_BUTTON, on_button)

    timers = []
    for x in xrange(20):
        t = wx.PyTimer(on_button)
        t.Start(5, False)
        timers.append(t)

    s = f.Sizer = wx.BoxSizer(wx.HORIZONTAL)
    s.Add(b)
    f.Show()

    a.MainLoop()
コード例 #12
0
ファイル: seikamini.py プロジェクト: school510587/BPDA-driver
	def __init__(self):
		super(BrailleDisplayDriver, self).__init__()
		pint = c_int * 1
		nCells = pint(0)
		nBut = pint(0)

		# seikaDll.BrailleOpen.errcheck=self.seika_errcheck
		seikaDll.BrailleOpen.restype=c_int
		seikaDll.BrailleOpen.argtype=(c_int, c_int)

		# seikaDll.GetBrailleDisplayInfo.errcheck=self.seika_errcheck
		seikaDll.GetBrailleDisplayInfo.restype=c_int
		seikaDll.GetBrailleDisplayInfo.argtype=(c_void_p, c_void_p)

		# seikaDll.UpdateBrailleDisplay.errcheck=self.seika_errcheck
		seikaDll.UpdateBrailleDisplay.restype=c_int
		seikaDll.UpdateBrailleDisplay.argtype=(c_char_p, c_int)

		# seikaDll.GetBrailleKey.errcheck=self.seika_errcheck
		seikaDll.GetBrailleKey.restype=c_int
		seikaDll.GetBrailleKey.argtype=(c_void_p, c_void_p)

		seikaDll.BrailleClose.restype=c_int

		if seikaDll.BrailleOpen(2, 0): # test USB
			seikaDll.GetBrailleDisplayInfo(nCells, nBut)
			log.info("seikamini an USB-HID, Cells {c} Buttons {b}".format(c=nCells[0], b=nBut[0]))
			self.numCells=nCells[0]
			# self.numBtns=nBut[0]
		else: # search the blutooth ports
			for portInfo in sorted(hwPortUtils.listComPorts(onlyAvailable=True), key=lambda item: "bluetoothName" in item):
				port = portInfo["port"]
				hwID = portInfo["hardwareID"]
				if not hwID.startswith(r"BTHENUM"): # Bluetooth Ports
					continue
				bName = ""
				try:
					bName = portInfo["bluetoothName"]
				except KeyError:
					continue
				if not bName.startswith(r"TSM"): # seikamini and then the 4-Digits
					continue

				try:
					pN = port.split("COM")[1]
				except IndexError:
					pN = "0"
				portNum = int(pN)
				log.info("seikamini test {c}, {b}".format(c=port, b=bName))
		
				if seikaDll.BrailleOpen(0, portNum):
					seikaDll.GetBrailleDisplayInfo(nCells, nBut)
					log.info("seikamini via Bluetooth {p} Cells {c} Buttons {b}".format(p=port, c=nCells[0], b=nBut[0]))
					self.numCells=nCells[0]
					# self.numBtns=nBut[0]
					break
			else:
				raise RuntimeError("No MINI-SEIKA display found")
		self._readTimer = wx.PyTimer(self.handleResponses)
		self._readTimer.Start(READ_INTERVAL)
コード例 #13
0
    def __init__(self, parent, log):
        wx.StatusBar.__init__(self, parent, -1)

        # This status bar has three fields
        self.SetFieldsCount(3)
        # Sets the three fields to be relative widths to each other.
        self.SetStatusWidths([-2, -1, -2])
        self.log = log
        self.sizeChanged = False
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        # Field 0 ... just text
        self.SetStatusText("A Custom StatusBar...", 0)

        # This will fall into field 1 (the second field)
        self.cb = wx.CheckBox(self, 1001, "toggle clock")
        self.Bind(wx.EVT_CHECKBOX, self.OnToggleClock, self.cb)
        self.cb.SetValue(True)

        # set the initial position of the checkbox
        self.Reposition()

        # We're going to use a timer to drive a 'clock' in the last
        # field.
        self.timer = wx.PyTimer(self.Notify)
        self.timer.Start(1000)
        self.Notify()
コード例 #14
0
ファイル: filetransferlist.py プロジェクト: sgricci/digsby
    def __init__(self, parent, data):
        self.xfer = data

        self.text = ''

        self.links = {}

        self.UpdateSkin(first=True)
        AnyRow.__init__(self,
                        parent,
                        data,
                        use_checkbox=False,
                        linkobservers=False)

        self.SetMinSize((20, self.MinSize.height))

        self._bc_timer = wx.PyTimer(lambda: wx.CallAfter(
            self.on_completed_changed, self.xfer, None, None, None))
        self._bc_timer.Start(self.update_interval)

        data.add_gui_observer(self.on_completed_changed, 'completed')
        data.add_gui_observer(self.on_update_gui, 'state')

        if getattr(self.xfer, 'autoremove', False):
            if self.xfer.state in self.xfer.autoremove_states:
                self.on_remove()
コード例 #15
0
 def setStatusBar(self):
     self.sb = self.CreateStatusBar(2)
     self.SetStatusWidths([-1, -2])
     self.SetStatusText("Ready", 1)
     self.timer = wx.PyTimer(self.Notify)
     self.timer.Start(1000, wx.TIMER_CONTINUOUS)
     self.Notify()
コード例 #16
0
ファイル: mb408sl.py プロジェクト: ABuffEr/mb408sl-driver
 def __init__(self, port):
     global mbCellsMap, mbBaud, mbDll
     super(BrailleDisplayDriver, self).__init__()
     mbCellsMap = [convertMbCells(x) for x in rangeFunc(256)]
     if mbBaud:
         log.info("Try MDV on port %s at saved baud %d" % (port, mbBaud))
     else:
         log.info("Try MDV on port %s at baud 38400 and 19200" % port)
     mbPort = bytes(port.encode("mbcs"))
     mbFound = False
     bauds = (mbBaud, ) if mbBaud else (38400, 19200)
     if not mbBaud:
         args = (
             _("Please wait"),
             Spri.NOW,
         ) if py3 else (_("Please wait"), )
         speakMessage(*args)
     for baud in bauds:
         log.info("Trying baud %d" % baud)
         loadDll(baud)
         if mbDll.BrlInit(mbPort, baud):
             mbBaud = baud
             mbFound = True
             log.info("Found MDV on port %s at baud %d" % (port, baud))
             break
     if not mbFound:
         resetBaud()
         loadDll(mbBaud)
         raise RuntimeError("No MB408 display found")
     else:
         self._keyCheckTimer = wx.PyTimer(self._handleKeyPresses)
         self._keyCheckTimer.Start(KEY_CHECK_INTERVAL)
         saveBaud()
コード例 #17
0
    def __init__(self, usr, *args, **kwds):
        #kwds['style'] = wx.DEFAULT_FRAME_STYLE
        kwds['style'] = bas.WX_DEFAULT_STYLE
        self.prg = iniPrg()
        self.ejercicios = []
        wx.Frame.__init__(self, *args, **kwds)

        self.Globales(usr)
        self.leeOpciones()
        self.iniDatos()
        self.cfgVentana(1000, 700, 250)
        self.creaAreaDatos()
        self.creaMenu(self.Menu())
        self.creaHerramientas(self.Herramientas())
        self.creaBarraStatus()
        self.creaDistribucion()
        self.habMenuHerram(self.mn.ARCHIVO, self.op.BUSCAR, self.bh.BUSCAR)
        self.habMenuHerram(self.mn.ARCHIVO, self.op.IMPRIMIR, self.bh.IMPRIMIR,
                           False)

        self.reloj = wx.PyTimer(self.actStatus)
        self.reloj.Start(1000)
        self.actStatus()

        self.opejercicio.Valor(0)
        self.opmes_inicial.Valor(0)
        self.opmes_final.Valor(int(fec.cFecha().mes) - 1)
コード例 #18
0
ファイル: oscargui.py プロジェクト: sgricci/digsby
def set_account_email(oscar, set):
    def show(email = None):
        val = GetTextFromUser(_('Enter an email address:'),
                              _('Edit Account Email: {username}').format(username=oscar.self_buddy.name),
                              default_value = email or '')

        if val is None or not val.strip():
            return

        log.info('setting new account email %r', val)
        return set(val)

    timer = wx.PyTimer(show)

    def success(email):
        if timer.IsRunning():
            timer.Stop()
            show(email)
        else:
            log.info('server response was too late: %r', email)

    def error():
        log.info('error retreiving account email for %r', oscar)
        if timer.IsRunning():
            timer.Stop()
            show()

    timer.StartOneShot(2000)
    oscar.get_account_email(success = success, error = error)
コード例 #19
0
    def search(self, e=None):
        if not pref('search.buddylist.enabled', True):
            if e is not None: e.Skip()
            return

        key, backspace = self._interpret_char_event(e)

        def size_like(img, i):
            img = img.ResizedSmaller(max(i.Width, i.Height)).PIL
            return img.ResizeCanvas(i.Width, i.Height).WXB

        icon = skin.get('StatusPanel.SearchIcon')
        self.ForceTextFieldBackground = True
        self.cbutton.SetIcon(size_like(icon, self._button_icon))
        self.DropDownButton.SetIcon(skin.get('StatusPanel.CancelSearchIcon'))
        self.searching = True
        if not hasattr(self, 'search_timer'):
            self.search_timer = wx.PyTimer(self.on_search_timer)
        self.search_timer.Start(500)

        self.display.TypeField()

        # emulate a keypress if one started the search
        self.TextField.ChangeValue(profile.blist.search_string)

        if key is not None:
            self.TextField.AppendText(key)
        if backspace:
            # emulate a backspace
            size = self.TextField.LastPosition
            self.TextField.Remove(size - 1, size)

        self.OnActivateSearch()
コード例 #20
0
def build_description_webview(parent, prefix):
    webview = WebKitDisplay(parent)

    # TODO: this entire figure-out-the-size-of-the-webview is also repeated in
    # infobox.py. We need to add a method to wxWebView that says: layout your
    # content at this width, and return your height.

    webview._loaded = False

    def on_load(e):
        e.Skip()
        if e.GetState() == wx.webview.WEBVIEW_LOAD_ONLOAD_HANDLED:
            webview._loaded = True

    def on_timer():
        if not webview._loaded:
            return

        webview._timer.Stop()
        with traceguard:
            height = webview.RunScript(
                'document.getElementById("container").clientHeight')
            height = int(height)
            webview.SetMinSize((-1, height))
            webview.GrandParent.Layout()
        parent.Thaw()

    webview.SetMinSize((-1, 160))
    webview._timer = wx.PyTimer(on_timer)
    webview._timer.StartRepeating(50)
    webview.Bind(wx.webview.EVT_WEBVIEW_LOAD, on_load)

    webview.SetPageSource(description_html)
    parent.Freeze()
    return webview
コード例 #21
0
    def OnInit(self):
        if not globalvar.CheckWxVersion([2, 9]):
            wx.InitAllImageHandlers()
        if __name__ == "__main__":
            self.cmdTimeStamp = os.path.getmtime(monFile['cmd'])
            self.Map = Map(cmdfile=monFile['cmd'],
                           mapfile=monFile['map'],
                           envfile=monFile['env'],
                           monitor=monName)
        else:
            self.Map = None

        self.mapFrm = MapFrame(parent=None,
                               id=wx.ID_ANY,
                               Map=self.Map,
                               size=monSize)
        # self.SetTopWindow(Map)
        self.mapFrm.Show()

        if __name__ == "__main__":
            self.timer = wx.PyTimer(self.watcher)
            #check each 0.5s
            global mtime
            mtime = 500
            self.timer.Start(mtime)

        return True
コード例 #22
0
 def onOk(self, evt):
     # #39: Prompt if switching from stable to development channel.
     currentUpdateChannel = config.conf["wintenApps"]["updateChannel"]
     newUpdateChannel = ("dev", "stable")[self.channels.GetSelection()]
     if currentUpdateChannel == "stable" and newUpdateChannel == "dev":
         if gui.messageBox(
                 # Translators: The confirmation prompt displayed when changing to development channel (with risks involved).
                 _("You are about to switch to development updates channel. Although updates from this channel brings exciting features, it also comes with updates that might be unstable at times and should be used for testing and sending feedback to the add-on developer. If you prefer to use stable releases, please answer no and switch to stable update channel. Are you sure you wish to switch to the development update channel?"
                   ),
                 # Translators: The title of the channel switch confirmation dialog.
                 _("Switching to unstable channel"),
                 wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION,
                 self) == wx.NO:
             return
     global updateChecker
     if updateChecker and updateChecker.IsRunning(): updateChecker.Stop()
     config.conf["wintenApps"][
         "autoUpdateCheck"] = self.autoUpdateCheckbox.Value
     config.conf["wintenApps"][
         "updateCheckTimeInterval"] = self.updateInterval.Value
     if not self.updateInterval.Value:
         config.conf["wintenApps"]["updateCheckTime"] = 0
         updateChecker = None
     else:
         updateChecker = wx.PyTimer(autoUpdateCheck)
         currentTime = time.time()
         whenToCheck = currentTime + (self.updateInterval.Value *
                                      addonUpdateCheckInterval)
         updateChecker.Start(whenToCheck - currentTime, True)
     config.conf["wintenApps"]["updateChannel"] = (
         "dev", "stable")[self.channels.GetSelection()]
     self.Destroy()
コード例 #23
0
	def __init__(self, parent, title, message):
		super(IndeterminateProgressDialog, self).__init__(title, message, parent=parent)
		self._speechCounter = -1
		self.timer = wx.PyTimer(self.Pulse)
		self.timer.Start(1000)
		self.Raise()
		self.Center(wx.BOTH | wx.CENTER_ON_SCREEN)
コード例 #24
0
ファイル: widgets.py プロジェクト: Mahmood-B/odemis
    def __init__(self, future, bar, label=None, full=True):
        """ Update a gauge widget and label, based on the progress reported by the
        ProgressiveFuture.

        future (ProgressiveFuture)
        bar (gauge): the progress bar widget
        label (StaticText or None): if given, will also update a the text with
          the time left.
        full (bool): If True, the time remaining will be displaying in full text
        otherwise a short text will displayed (eg, "1 min and 2 s")
        Note: when the future is complete (done), the progress bar will be set
        to 100%, but the text will not be updated.
        """
        self._future = future
        self._bar = bar
        self._label = label
        self._full_text = full

        # Will contain the info of the future as soon as we get it.
        self._start, self._end = future.get_progress()
        self._end = None
        self._prev_left = None
        self._last_update = 0  # when was the last GUI update

        # a repeating timer, always called in the GUI thread
        self._timer = wx.PyTimer(self._update_progress)
        self._timer.Start(250.0)  # 4 Hz

        # Set the progress bar to 0
        bar.Range = PROGRESS_RANGE
        bar.Value = 0

        future.add_update_callback(self._on_progress)
        future.add_done_callback(self._on_done)
コード例 #25
0
    def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, -1)

        #-------------------------------------------------------------------

        self.parent = parent

        #-------------------------------------------------------------------

        self.SetFieldsCount(2)
        self.SetStatusWidths([-7, -3])

        #-------------------------------------------------------------------

        self.sizeChanged = False

        # Bind some events to an events handler
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)

        #-------------------------------------------------------------------

        self.timer = wx.PyTimer(self.Notify)
        # Update every 1000 milliseconds
        self.timer.Start(1000)
        self.Notify()
コード例 #26
0
ファイル: pvConnect.py プロジェクト: APS-USAXS/wxmtxy
 def __init__(self, interval_s=0.1):
     '''@param interval_s: [float] interval between calls to ca.poll()'''
     if IMPORTED_WX:  # only if wx was imported
         self.running = False
         self.interval_s = interval_s
         self.timer = wx.PyTimer(self.poll)
         self.timer.Start(int(self.interval_s * 1000))
コード例 #27
0
ファイル: __init__.py プロジェクト: jxd88757550/nvda
	def __init__(self, parent, title, message):
		super(IndeterminateProgressDialog, self).__init__(title, message, parent=parent)
		self._speechCounter = -1
		self.timer = wx.PyTimer(self.Pulse)
		self.timer.Start(1000)
		self.Raise()
		self.CentreOnScreen()
コード例 #28
0
    def __init__(self,
                 timer_secs,
                 time_mode,
                 trigger_mode,
                 current_time_func=time):
        assert isinstance(timer_secs, int)
        assert trigger_mode in allowed_trigger_modes
        assert time_mode in allowed_time_modes

        self.has_focus = False

        self.timer_secs = timer_secs
        self.time_mode = time_mode
        self.trigger_mode = trigger_mode

        self.scenario_identifier = '%s_%s_%s' % (timer_secs, time_mode,
                                                 trigger_mode)

        assert hasattr(current_time_func, '__call__')
        self._get_time = current_time_func

        self._reset_time(
            start=False)  # the last UNIX time we showed an ad ( = now).
        self.on_reload = Delegate()

        if self.trigger_mode == 'focus':
            self.wx_timer = wx.PyTimer(self._on_wxtimer)
            self.wx_timer.StartRepeating(1000)
コード例 #29
0
ファイル: print_pdf.py プロジェクト: zgyarmati/inkstitch
    def __init__(self, *args, **kwargs):
        self.print_server = kwargs.pop("print_server")
        wx.Frame.__init__(self, *args, **kwargs)

        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)

        message = _(
            "A print preview has been opened in your web browser.  "
            "This window will stay open in order to communicate with the JavaScript code running in your browser.\n\n"
            "This window will close after you close the print preview in your browser, or you can close it manually if necessary."
        )
        text = wx.StaticText(panel, label=message)
        font = wx.Font(14, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        text.SetFont(font)
        sizer.Add(text, proportion=1, flag=wx.ALL | wx.EXPAND, border=20)

        stop_button = wx.Button(panel, id=wx.ID_CLOSE)
        stop_button.Bind(wx.EVT_BUTTON, self.close_button_clicked)
        sizer.Add(stop_button,
                  proportion=0,
                  flag=wx.ALIGN_CENTER | wx.ALL,
                  border=10)

        panel.SetSizer(sizer)
        panel.Layout()

        self.timer = wx.PyTimer(self.__watcher)
        self.timer.Start(250)
コード例 #30
0
    def __init__(self, win, autohide=False, enabled=True):
        self.Animate = True
        self.autohidden = False
        self.AutoHide = False
        self.docked = False
        self.docking = False
        self.LinkedWindows = []
        self.manualMove = False
        self.motiontrigger = False
        self.pixelsdragged = 0
        self.ShouldShowInTaskbar = lambda: True
        self.timer = wx.PyTimer(self.OnTimer)
        self.spookyGhostWindow = None

        self.win = win
        self.win.Bind(wx.EVT_ACTIVATE, self.OnActivateWin)
        self.win.Bind(wx.EVT_MOVE, self.OnMoving)

        self.lastrect = None

        self.SetAutoHide(autohide)

        self.OnDock = Delegate()
        self.OnHide = Delegate()

        publisher = Publisher()
        publisher.subscribe(self.OnActivateApp, 'app.activestate.changed')