コード例 #1
0
ファイル: Wlists.py プロジェクト: mmrvka/xbmc
 def key(self, char, event):
     (what, message, when, where, modifiers) = event
     sel = self.getselection()
     newselection = []
     if char == Wkeys.uparrowkey:
         if len(sel) >= 1 and min(sel) > 0:
             newselection = [min(sel) - 1]
         else:
             newselection = [0]
     elif char == Wkeys.downarrowkey:
         if len(sel) >= 1 and max(sel) < (len(self.items) - 1):
             newselection = [max(sel) + 1]
         else:
             newselection = [len(self.items) - 1]
     else:
         modifiers = 0
         if (self.lasttime + self.timelimit) < Evt.TickCount():
             self.lasttyping = ""
         if self.typingcasesens:
             self.lasttyping = self.lasttyping + char
         else:
             self.lasttyping = self.lasttyping + string.lower(char)
         self.lasttime = Evt.TickCount()
         i = self.findmatch(self.lasttyping)
         newselection = [i]
     if modifiers & Events.shiftKey and not self._list.selFlags & Lists.lOnlyOne:
         newselection = newselection + sel
     self.setselection(newselection)
     self._list.LAutoScroll()
     self.click((-1, -1), 0)
コード例 #2
0
def wait():
    from Carbon import Evt
    from Carbon import Events
    global splash
    try:
        splash
    except NameError:
        return
    Qd.InitCursor()
    time = Evt.TickCount()
    whattext = 0
    drawtext(whattext)
    while _keepsplashscreenopen:
        ok, event = Evt.EventAvail(Events.highLevelEventMask)
        if ok:
            # got apple event, back to mainloop
            break
        ok, event = Evt.EventAvail(Events.mDownMask | Events.keyDownMask
                                   | Events.updateMask)
        if ok:
            ok, event = Evt.WaitNextEvent(
                Events.mDownMask | Events.keyDownMask | Events.updateMask, 30)
            if ok:
                (what, message, when, where, modifiers) = event
                if what == Events.updateEvt:
                    if Win.WhichWindow(message) == splash:
                        UpdateSplash(1, whattext)
                else:
                    break
        if Evt.TickCount() - time > 360:
            whattext = not whattext
            drawtext(whattext)
            time = Evt.TickCount()
    del splash
コード例 #3
0
    def mainloop(self, mask=highLevelEventMask, timeout=60):
        stoptime = Evt.TickCount() + timeout
        while not self.quitting and Evt.TickCount() < stoptime:
            self._dooneevent(mask, timeout)

        if not self.quitting:
            print 'argvemulator: timeout waiting for arguments'
        self.close()
コード例 #4
0
    def mainloop(self, mask=highLevelEventMask, timeout=1 * 60):
        # Note: this is not the right way to run an event loop in OSX or even
        # "recent" versions of MacOS9. This is however code that has proven
        # itself.
        stoptime = Evt.TickCount() + timeout
        while not self.quitting and Evt.TickCount() < stoptime:
            self._dooneevent(mask, timeout)

        if not self.quitting:
            print "argvemulator: timeout waiting for arguments"

        self.close()
コード例 #5
0
ファイル: mw_dialogs.py プロジェクト: ystallonne/grins
 def setitem(self, item, value, clear=0):
     oldport = Qd.GetPort()
     if item >= self.itemcount:
         self._listwidget.insert(-1, ['[untraced]'] *
                                 (item - self.itemcount + 1))
         self.itemcount = item + 1
     self._listwidget.replace(item, value)
     if clear:
         for i in range(item + 1, self.itemcount):
             self._listwidget.replace(i, '')
     self._listwidget.select(item, autoscroll=1)
     if Evt.TickCount() / 5 != self.lasttime:
         self.lasttime = Evt.TickCount() / 5
         self._dlg.DrawDialog()
     Qd.SetPort(oldport)
コード例 #6
0
ファイル: Wtext.py プロジェクト: mmrvka/xbmc
 def click(self, point, modifiers):
     if not self._enabled:
         return
     self.ted.WEClick(point, modifiers, Evt.TickCount())
     self.selectionchanged()
     self.updatescrollbars()
     return 1
コード例 #7
0
        def mainloop(self, mask=highLevelEventMask, timeout=1 * 60):
            # Note: this is not the right way to run an event loop in OSX or
            # even "recent" versions of MacOS9. This is however code that has
            # proven itself.

            # Remove the funny -psn_xxx_xxx argument
            if len(sys.argv) > 1 and sys.argv[1][:4] == '-psn':
                del sys.argv[1]

            stoptime = Evt.TickCount() + timeout
            while not self.quitting and Evt.TickCount() < stoptime:
                self._dooneevent(mask, timeout)

            if not self.quitting:
                print "argvemulator: timeout waiting for arguments"

            self.close()
コード例 #8
0
 def _tick(self):
     if os.name == 'mac':
         # XXXX Mac-specific
         self.engine.EventOccurred((0, 0, Evt.TickCount(), (0, 0), 0))
     elif os.name == 'posix':
         self.engine.EventOccurred((0, 0, 0, (0, 0), 0))
     else:
         raise error, 'Unknown environment in _tick (internal error).'
コード例 #9
0
ファイル: Wlists.py プロジェクト: mmrvka/xbmc
 def __init__(self,
              possize,
              items=None,
              callback=None,
              flags=0,
              cols=1,
              typingcasesens=0):
     if items is None:
         items = []
     self.items = items
     Wbase.SelectableWidget.__init__(self, possize)
     self._selected = 0
     self._enabled = 1
     self._list = None
     self._cols = cols
     self._callback = callback
     self._flags = flags
     self.typingcasesens = typingcasesens
     self.lasttyping = ""
     self.lasttime = Evt.TickCount()
     self.timelimit = 30
     self.setitems(items)
     self.drawingmode = 0
コード例 #10
0
ファイル: mw_dialogs.py プロジェクト: ystallonne/grins
 def __init__(self):
     _SelectionDialog.__init__(self, "Stack", [], None, 0)
     self._dlg.HideDialogItem(ITEM_SELECT_OK)
     self.itemcount = 0
     self.lasttime = Evt.TickCount() / 5