Exemplo n.º 1
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds,
         SubMenu('I~n~fo', kbAltN) +
         MenuItem('I~n~fo', cmTechInfo, kbAltI, hcNoContext, 'Alt+I') +
         MenuItem('E~x~it', cmQuit, kbAltX, hcNoContext, 'Alt+X'))
Exemplo n.º 2
0
    def popup(self):
        bounds = Rect(0, 0, 0, 0)
        # for clarity, we'll create separately the menu to insert into the menubox
        theMenu = Menu(
            MenuItem("Item ~1~",
                     cmOne,
                     kbAltI,
                     hcNoContext,
                     "Alt-1",
                     nextItem=MenuItem("Item ~2~",
                                       cmTwo,
                                       kbAltT,
                                       hcNoContext,
                                       "Alt-2",
                                       nextItem=MenuItem(
                                           "E~x~it", cmQuit, kbAltX,
                                           hcNoContext, "Alt-X"))))

        # now create the menu with no parent
        mb = MenuBox(bounds, theMenu, 0)

        # however, if we don't specify appropriate bounds, we must do something to ensure it is appropriately
        # positioned on the desktop
        mb.options |= ofCentered

        # then make sure it's valid and execute it
        if self.validView(mb):
            result = self.desktop.execView(mb)
            self.destroy(mb)

        event = Event(evCommand)
        event.message.command = result
        self.putEvent(event)
        self.clearEvent(event)
Exemplo n.º 3
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(bounds,
                    SubMenu('~F~ile', kbAltF, hcNoContext) +
                    MenuItem('~A~bout...', cmAboutCmd, kbNoKey, hcNoContext) +
                    MenuItem.newLine() +
                    MenuItem('E~x~it...', cmQuit, kbAltX, hcNoContext))
Exemplo n.º 4
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds,
         Menu(
             SubMenu('~F~ile', kbAltF, hcNoContext) +
             MenuItem('~A~bout', cmAbout, kbAltA, hcNoContext, 0) +
             MenuItem('~G~rid View', cmList, kbAltL, hcNoContext, 0)))
Exemplo n.º 5
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds,
         Menu(
             SubMenu('~≡~', kbAltSpace) +
             MenuItem('~A~bout', cmAbout, kbAltA, hcNoContext, '') +
             MenuItem('~P~opup', cmPopup, kbAltP, hcNoContext, '')))
Exemplo n.º 6
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds,
         SubMenu('~F~ile', kbAltF) +
         MenuItem('~D~ialog', cmNewDialog, kbF3, hcNoContext, 'F3') +
         MenuItem.newLine() +
         MenuItem('E~x~it', cmQuit, kbAltX, hcNoContext, 'Alt+X'))
Exemplo n.º 7
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     sub1 = SubMenu('~≡~', kbAltSpace, hcSystem) + MenuItem(
         '~A~bout', cmAbout, kbNoKey, hcAbout, '')
     sub2 = (SubMenu('~F~ile', kbNoKey, hcFile) +
             MenuItem('~N~ew', cmFileNew, kbNoKey, hcFileNew, 0, '') +
             MenuItem.newLine() +
             MenuItem('E~x~it', cmQuit, kbAltX, hcFileExit, 'Alt+X'))
     return MenuBar(bounds, Menu(sub1 + sub2))
Exemplo n.º 8
0
    def initMenuBar(self, bounds):
        bounds.bottomRight.y = bounds.topLeft.y + 1

        menuBar = MenuBar(bounds,
                          SubMenu('~F~ile', kbAltF) +
                          MenuItem('~A~bout', cmAbout, kbAltA, hcNoContext, 'Alt+A') +
                          MenuItem.newLine() +
                          MenuItem('Exit', 0, kbNoKey, helpCtx=hcNoContext,
                                   subMenu=Menu(
                                       MenuItem('Exit & ~S~ave', cmQuit, kbAltX, hcNoContext, None, nextItem=
                                       MenuItem('Exit & ~A~bandon', cmQuit, kbAltY, hcNoContext, None, nextItem=
                                       MenuItem('Just ~Q~uit', cmQuit, kbAltZ, hcNoContext, None, nextItem=
                                       MenuItem('~N~ext Level', 0, kbNoKey,
                                                subMenu=Menu(
                                                    MenuItem('~O~ne', cmQuit, kbAltX, hcNoContext, None, nextItem=
                                                    MenuItem('~T~wo', cmQuit, kbAltX)
                                                             )
                                                )))))
                                       ),

                                   )


                          )

        return menuBar
Exemplo n.º 9
0
 def initMenuBar(self, bounds):
     # always do this
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(bounds,
                    SubMenu('~F~ile', kbAltF) +
                    MenuItem('E~x~it', cmQuit, cmQuit, hcNoContext, 'Alt+X') +
                    SubMenu('~W~indow', kbAltW) +
                    MenuItem('~C~lose', cmClose, kbCtrlW, hcNoContext, 'Ctrl+W') +
                    MenuItem('~N~ext', cmNext, kbF6, hcNoContext, 'F6') +
                    MenuItem('~Z~oom', cmZoom, kbF5, hcNoContext, 'F5') +
                    MenuItem('~D~ialog', cmNewDialog, kbF2, hcNoContext, 'F2'))
Exemplo n.º 10
0
    def initMenuBar(self, bounds):
        bounds.bottomRight.y = bounds.topLeft.y + 1

        return MenuBar(
            bounds,
            SubMenu("~Ф~айл", 0) +
            MenuItem("~O~pen", 200, kbF3, hcNoContext, "F3") +
            MenuItem("~N~ew", 200, kbF4, hcNoContext, "F4") +
            MenuItem.newLine() +
            MenuItem("E~x~it", cmQuit, kbAltX, hcNoContext, "Alt-X") +
            # Probably the wrong translation of 'window'
            SubMenu("~о~кно", kbAltW) +
            MenuItem("~N~ext", cmNext, kbF6, hcNoContext, "F6") +
            MenuItem("~Z~oom", cmZoom, kbF5, hcNoContext, "F5"))
Exemplo n.º 11
0
    def initMenuBar(self, bounds):
        bounds.bottomRight.y = bounds.topLeft.y + 1
        subMenu1 = (SubMenu('~≡~', 0, hcNoContext) +
                    MenuItem('~A~bout...', AppCommands.cmAboutCmd, kbNoKey, HelpContexts.hcSAbout) +
                    MenuItem.newLine() +
                    MenuItem('~P~uzzle', AppCommands.cmPuzzleCmd, kbNoKey, HelpContexts.hcSPuzzle) +
                    MenuItem('Ca~l~endar', AppCommands.cmCalendarCmd, kbNoKey, HelpContexts.hcSCalendar) +
                    MenuItem('Ascii ~T~able', AppCommands.cmAsciiCmd, kbNoKey, HelpContexts.hcSAsciiTable) +
                    MenuItem('~C~alculator', AppCommands.cmCalcCmd, kbNoKey, HelpContexts.hcCalculator))

        subMenu2 = (SubMenu('~F~ile', None, HelpContexts.hcFile) +
                    MenuItem('~O~pen', AppCommands.cmOpenCmd, kbF3, HelpContexts.hcFOpen, 'F3') +
                    MenuItem('~C~hange Dir...', AppCommands.cmChDirCmd, kbNoKey, HelpContexts.hcFChangeDir) +
                    MenuItem.newLine() +
                    MenuItem('~D~ialog', AppCommands.cmDialogCmd, kbNoKey, hcNoContext) +
                    MenuItem('~S~hell', AppCommands.cmShellCmd, kbNoKey, HelpContexts.hcFDosShell) +
                    MenuItem.newLine() +
                    MenuItem('E~x~it', cmQuit, kbAltX, hcNoContext, 'Alt+X'))

        subMenu3 = (SubMenu('~W~indows', None, HelpContexts.hcWindows) +
                    MenuItem('~R~esize/move', cmResize, kbCtrlF5, HelpContexts.hcWSizeMove, 'Ctrl+F5') +
                    MenuItem('~Z~oom', cmZoom, kbF5, HelpContexts.hcWZoom, 'F5') +
                    MenuItem('~N~ext', cmNext, kbF6, HelpContexts.hcWNext, 'F6') +
                    MenuItem('~C~lose', cmClose, kbCtrlW, HelpContexts.hcWClose, 'Ctrl+W') +
                    MenuItem('~T~ile', cmTile, kbNoKey, HelpContexts.hcWTile) +
                    MenuItem('C~a~scade', cmCascade, kbNoKey, HelpContexts.hcWCascade))

        subMenu4 = (SubMenu('~O~ptions', None, HelpContexts.hcOptions) +
                    MenuItem('~M~ouse...', AppCommands.cmMouseCmd, kbNoKey, HelpContexts.hcOMouse) +
                    MenuItem('~C~olors...', AppCommands.cmColorCmd, kbNoKey, HelpContexts.hcOColors))

        subMenu5 = (SubMenu('~R~esolution', None, hcNoContext) +
                    MenuItem('~1~ 80x25', AppCommands.cmTest80x25, kbNoKey, hcNoContext) +
                    MenuItem('~2~ 80x28', AppCommands.cmTest80x28, kbNoKey, hcNoContext) +
                    MenuItem('~3~ 80x50', AppCommands.cmTest80x50, kbNoKey, hcNoContext) +
                    MenuItem('~4~ 90x30', AppCommands.cmTest90x30, kbNoKey, hcNoContext) +
                    MenuItem('~5~ 94x34', AppCommands.cmTest94x34, kbNoKey, hcNoContext) +
                    MenuItem('~6~ 132x25', AppCommands.cmTest132x25, kbNoKey, hcNoContext) +
                    MenuItem('~7~ 132x50', AppCommands.cmTest132x50, kbNoKey, hcNoContext) +
                    MenuItem('~8~ 132x60', AppCommands.cmTest132x60, kbNoKey, hcNoContext) +
                    MenuItem('~9~ 160x60', AppCommands.cmTest160x60, kbNoKey, hcNoContext)
                    )

        return MenuBar(bounds, subMenu1 + subMenu2 + subMenu3 + subMenu4 + subMenu5)
Exemplo n.º 12
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds, Menu(MenuItem("~A~bout", cmAbout, kbAltA, hcNoContext, 0)))
Exemplo n.º 13
0
 def initMenuBar(self, bounds):
     bounds.bottomRight.y = bounds.topLeft.y + 1
     return MenuBar(
         bounds,
         SubMenu('~F~ile', kbAltF) +
         MenuItem('E~x~it', cmQuit, kbAltX, hcNoContext, 'Alt+X'))
Exemplo n.º 14
0
    def initMenuBar(self, bounds):
        bounds.bottomRight.y = bounds.topLeft.y + 1

        sub1 = (SubMenu('~F~ile', kbAltF) +
                MenuItem("~O~pen", cmOpen, kbF3, hcNoContext, "F3") +
                MenuItem("~N~ew", cmNew, kbNoKey) +
                MenuItem("~S~ave", cmSave, kbF2, hcNoContext, "F2") +
                MenuItem("S~a~ve as...", cmSaveAs, kbNoKey) +
                MenuItem.newLine() +
                MenuItem("~C~hange dir...", cmChangeDrct, kbNoKey) +
                MenuItem("E~x~it", cmQuit, kbAltX, hcNoContext, "Alt+X"))

        sub2 = (
            SubMenu("~E~dit", kbAltE) + MenuItem("~U~ndo", cmUndo, kbNoKey) +
            MenuItem.newLine() +
            MenuItem("Cu~t~", cmCut, kbShiftDel, hcNoContext, "Shift+Del") +
            MenuItem("~C~opy", cmCopy, kbCtrlIns, hcNoContext, "Ctrl+Ins") +
            MenuItem("~P~aste", cmPaste, kbShiftIns, hcNoContext, "Shift+Ins")
            + MenuItem("~S~how clipboard", cmShowClip, kbNoKey) +
            MenuItem.newLine() +
            MenuItem("~C~lear", cmClear, kbCtrlDel, hcNoContext, "Ctrl+Del"))

        sub3 = (SubMenu("~S~earch", kbAltS) +
                MenuItem("~F~ind...", cmFind, kbNoKey) +
                MenuItem("~R~eplace...", cmReplace, kbNoKey) +
                MenuItem("~S~earch again", cmSearchAgain, kbNoKey))

        sub4 = (SubMenu("~W~indows", kbAltW) + MenuItem(
            "~S~ize/move", cmResize, kbCtrlF5, hcNoContext, "Ctrl+F5") +
                MenuItem("~Z~oom", cmZoom, kbF5, hcNoContext, "F5") +
                MenuItem("~T~ile", cmTile, kbNoKey) +
                MenuItem("C~a~scade", cmCascade, kbNoKey) +
                MenuItem("~N~ext", cmNext, kbF6, hcNoContext, "F6") + MenuItem(
                    "~P~revious", cmPrev, kbShiftF6, hcNoContext, "Shift+F6") +
                MenuItem("~C~lose", cmClose, kbCtrlW, hcNoContext, "Ctrl+W"))
        return MenuBar(bounds, sub1 + sub2 + sub3 + sub4)
Exemplo n.º 15
0
    def initMenuBar(self, bounds):
        bounds.bottomRight.y = bounds.topLeft.y + 1

        return MenuBar(bounds,
                       Menu(MenuItem('~T~est', cmTest, kbNoKey, hcNoContext)))
Exemplo n.º 16
0
    def initMenuBar(self, bounds):
        sub1 = (
            SubMenu('~≡~', 0, hcNoContext) +
            MenuItem('~A~bout...', CommandCodes.cmAbout, kbNoKey, hcNoContext))
        sub2 = (SubMenu('~F~ile', 0) + MenuItem(
            '~L~ife Window', CommandCodes.cmCreate, kbF9, hcNoContext, 'F9') +
                MenuItem.newLine() +
                MenuItem('E~x~it', cmQuit, kbAltX, hcNoContext, 'Alt+X'))
        sub3 = (SubMenu('~A~ction', 0) + MenuItem(
            '~C~lear', CommandCodes.cmClearBoard, kbNoKey, hcNoContext) +
                MenuItem('~O~ne Step', CommandCodes.cmOneStep, kbNoKey,
                         hcNoContext) +
                MenuItem('~R~andomize', CommandCodes.cmRandom, kbNoKey,
                         hcNoContext) +
                MenuItem('~S~tart/Stop', CommandCodes.cmStartStop, kbNoKey,
                         hcNoContext))
        sub4 = (SubMenu('~W~indow', 0) + MenuItem(
            '~S~ize/Move', cmResize, kbCtrlF5, hcNoContext, 'Ctrl+F5') +
                MenuItem('~Z~oom', cmZoom, kbF5, hcNoContext, 'F5') +
                MenuItem('~N~ext', cmNext, kbF6, hcNoContext, 'F6') + MenuItem(
                    '~P~revious', cmPrev, kbShiftF6, hcNoContext, 'Shift+F6') +
                MenuItem('~C~lose', cmClose, kbCtrlW, hcNoContext, 'Ctrl+W') +
                MenuItem.newLine() +
                MenuItem('~T~ile', cmTile, kbNoKey, hcNoContext) +
                MenuItem('C~a~scade', cmCascade, kbNoKey, hcNoContext))

        ITEM = lambda name, comm: MenuItem(name, comm, kbNoKey, hcNoContext)

        sub5 = (SubMenu('Patterns ~1~', 0) +
                ITEM("Glider Gun", CommandCodes.cmPat01) +
                ITEM("Figure Eight", CommandCodes.cmPat02) +
                ITEM("Pulsar", CommandCodes.cmPat03) +
                ITEM("Barber Pole P2", CommandCodes.cmPat04) +
                ITEM("Achim P5", CommandCodes.cmPat05) +
                ITEM("Hertz P4", CommandCodes.cmPat06) +
                ITEM("Tumbler", CommandCodes.cmPat07) +
                ITEM("Pulse1 P4", CommandCodes.cmPat08) +
                ITEM("Shining Flower P5", CommandCodes.cmPat09) +
                ITEM("Pulse2 P6", CommandCodes.cmPat10) +
                ITEM("Pinwheel, Clock P4", CommandCodes.cmPat11) +
                ITEM("Pentadecatholon", CommandCodes.cmPat12) +
                ITEM("Piston", CommandCodes.cmPat13) +
                ITEM("Piston2", CommandCodes.cmPat14) +
                ITEM("Switch Engine", CommandCodes.cmPat15))
        sub6 = (SubMenu('Patterns ~2~', 0) +
                ITEM("Gears (Gear, Flywheel, Blinker)", CommandCodes.cmPat16) +
                ITEM("Turbine8", CommandCodes.cmPat17) +
                ITEM("P16", CommandCodes.cmPat18) +
                ITEM("Puffer", CommandCodes.cmPat19) +
                ITEM("Escort", CommandCodes.cmPat20) +
                ITEM("Dart Speed 1/3", CommandCodes.cmPat21) +
                ITEM("Period 4 Speed 1/2", CommandCodes.cmPat22) +
                ITEM("Another Period 4 Speed 1/2", CommandCodes.cmPat23) +
                ITEM("Smallest Known Period 3 Spaceship Speed 1/3",
                     CommandCodes.cmPat24) +
                ITEM("Turtle Speed 1/3", CommandCodes.cmPat25) +
                ITEM("Smallest Known Period 5 Speed 2/5", CommandCodes.cmPat26)
                + ITEM("Sym Puffer", CommandCodes.cmPat27) +
                ITEM("], Near Ship, Pi Heptomino", CommandCodes.cmPat28) +
                ITEM("R Pentomino", CommandCodes.cmPat29))
        bounds.bottomRight.y = bounds.topLeft.y + 1
        return MenuBar(bounds, sub1 + sub2 + sub3 + sub4 + sub5 + sub6)