Esempio n. 1
0
    def __init__(self, parent, title):
        Frame.__init__(self, parent, title=title, size=(500, 400))
        self.setup_xmlrpc_server()
        self.completed = False

        # Create the notebook
        self.notebook = Notebook(self, style=NB_MULTILINE)
        # Setting up the menu
        file_menu = Menu()
        exit_item = file_menu.Append(ID_EXIT, '&Exit...',
                                     'Exit Settings Window')
        self.Bind(EVT_MENU, self.prepare_for_exit, exit_item)
        menu_bar = MenuBar()
        menu_bar.Append(file_menu, '&File')
        self.SetMenuBar(menu_bar)

        alpha = settings.SETTINGS.keys()
        alpha.sort()
        self.fields = []
        for top in alpha:
            self.make_page(top)

        self.CenterOnScreen()
        self.Show()

        self.Bind(EVT_CLOSE, self.xmlrpc_kill)

        def start_server():
            while not self.server_quit:
                self.server.handle_request()

        Timer(0.5, start_server).start()
        Timer(300, self.xmlrpc_kill).start()
 def __init__(self, parent, title, server):
     Frame.__init__(self, parent, title=title, size=(500, 400))
     global SETTINGS_FRAME
     SETTINGS_FRAME = self
     self.server = server
     self.setup_xmlrpc_server()
     self.completed = False
     self.notebook = Notebook(self, style=NB_MULTILINE)
     file_menu = Menu()
     self.next_page = file_menu.Append(ID_ANY, '&Next page\tRAWCTRL+TAB',
                                       'Next page')
     self.prev_page = file_menu.Append(ID_ANY,
                                       '&Prev page\tRAWCTRL+SHIFT+TAB',
                                       'Prev page')
     self.Bind(EVT_MENU, self.OnTab, self.next_page)
     self.Bind(EVT_MENU, self.OnTab, self.prev_page)
     exit_item = file_menu.Append(ID_EXIT, '&Exit...',
                                  'Exit Settings Window')
     self.Bind(EVT_MENU, self.prepare_for_exit, exit_item)
     menu_bar = MenuBar()
     menu_bar.Append(file_menu, '&File')
     self.SetMenuBar(menu_bar)
     self.fields = []
     for top in sorted(settings.SETTINGS.keys()):  # pylint: disable=no-member
         self.make_page(top)
     self.CenterOnScreen()
     self.Show()
     self.Bind(EVT_ON_KILL, self.OnKill)
     self.Bind(EVT_ON_COMPLETE, self.OnComplete)
     self.Bind(EVT_CLOSE, self.xmlrpc_kill)
     self.expiration = threading.Timer(300, self.xmlrpc_kill)
     self.expiration.start()
Esempio n. 3
0
 def build_menu(self, root, data):
     from wx import MenuBar
     menu_bar = MenuBar()
     for eachMenuData in data:
         menu_label = eachMenuData[0]
         menu_items = eachMenuData[1]
         menu_bar.Append(self.__build_menu(menu_items), menu_label)
     root.SetMenuBar(menu_bar)
Esempio n. 4
0
    def config_menu(self):
        '''Here we configure the main windows menu'''
        menu_bar = MenuBar()
        file_menu = Menu()
        self.file_item = file_menu.Append(wx.ID_EXIT, 'Quit',
                                          'Quit application')
        menu_bar.Append(file_menu, '&File')
        self.SetMenuBar(menu_bar)

        self.Bind(wx.EVT_MENU, self.OnQuit, self.file_item)
Esempio n. 5
0
 def format_menu_bar(self, obj: MenuBar):
     """Formats MenuItem info"""
     lines = ["MenuBar:"]
     if hasattr(obj, 'GetName'):
         lines.append(self.Fmt('name', obj.GetName()))
     lines.append(self.Fmt('class', obj.__class__))
     lines.append(self.Fmt('bases', obj.__class__.__bases__))
     lines.append(self.Fmt('module', inspect.getmodule(obj)))
     lines.append(self.Fmt('id', obj.GetId()))
     return lines
Esempio n. 6
0
    def setUpMenu(self):
        menuBar = MenuBar()

        fileMenu = wx.Menu()
        applyParamItem = wx.MenuItem(fileMenu, 100, 'Apply parameters to sql')
        menuBar.Append(fileMenu, '&File')
        self.Bind(wx.EVT_MENU, self.openSqlFrame,
                  fileMenu.AppendItem(applyParamItem))

        self.SetMenuBar(menuBar)
Esempio n. 7
0
    def __init__(self, parent, ID, title):
        Frame.__init__(self, parent, ID, title, DefaultPosition, Size(300, 200))
        menu = Menu()
        menu.Append(ID_EXIT, "E&xit", "Terminate the program")
        menuBar = MenuBar()
        menuBar.Append(menu, "&File")
        self.SetMenuBar(menuBar)
        EVT_MENU(self, ID_EXIT, self.DoExit)

        # make sure reactor.stop() is used to stop event loop:
        EVT_CLOSE(self, lambda evt: reactor.stop())
Esempio n. 8
0
    def create_menubar(self, language_list, style=0):
        modifier = 'Ctrl' if name == 'nt' else 'Opt'
        menubar = MenuBar()
        menubar_file = Menu()
        menubar_file.Append(ID_FILE_EXPORT, '&Export\t' + modifier + 'E')
        menubar_file.AppendSeparator()
        menubar_file.Append(ID_FILE_EXIT, 'E&xit\t' + modifier + 'W')

        menubar_edit = Menu()
        menubar_edit_timer = Menu()
        menubar_edit.AppendSubMenu(menubar_edit_timer, '&Timer')
        menubar_edit_timer.Append(ID_EDIT_TIMER_START,
                                  '&Start\t' + modifier + 'S')
        menubar_edit_timer.Append(ID_EDIT_TIMER_PAUSE,
                                  '&Pause\t' + modifier + 'P')
        menubar_edit_timer.Append(ID_EDIT_TIMER_RESET,
                                  '&Reset\t' + modifier + 'R')
        menubar_edit_time_stamp = Menu()
        menubar_edit.AppendSubMenu(menubar_edit_time_stamp, 'Time &Stamp')
        menubar_edit_time_stamp.Append(ID_EDIT_TIME_STAMP_NEW,
                                       '&New\t' + modifier + 'N')

        menubar_view = Menu()
        menubar_view.AppendCheckItem(ID_VIEW_SHOW_PREVIEW,
                                     'Show &Preview\t' + modifier + 'Shift+P')
        menubar_view_language = Menu()

        language_menu_item_list = []
        if language_list is not None:
            menubar_view_language.Bind(EVT_MENU,
                                       lambda x: self.change_language())
            menubar_view.AppendSubMenu(menubar_view_language, '&Language')

            for n in range(len(language_list)):
                language_menu_item_list.append(
                    menubar_view_language.AppendRadioItem(
                        ID_ANY, language_list[n]['Language Setting']))

        menubar_help = Menu()
        menubar_help.Append(ID_HELP_WELCOME,
                            '&Welcome\t' + modifier + 'Shift+H')
        menubar_help.AppendSeparator()
        menubar_help.Append(ID_HELP_VISIT_GITHUB, 'Visit &Github')
        menubar_help.AppendSeparator()
        menubar_help.Append(ID_HELP_ABOUT, '&About')

        menubar.Append(menubar_file, '&File')
        menubar.Append(menubar_edit, '&Edit')
        menubar.Append(menubar_view, '&View')
        menubar.Append(menubar_help, '&Help')

        return menubar, language_menu_item_list
Esempio n. 9
0
    def _createApplicationMenuBar(self):

        menuBar: MenuBar = MenuBar()
        fileMenu: Menu = Menu()
        helpMenu: Menu = Menu()

        fileMenu.Append(ID_PREFERENCES, 'Configure',
                        'Configure Application IDs')
        fileMenu.AppendSeparator()
        fileMenu.Append(ID_EXIT, '&Quit', "Quit Application")

        helpMenu.Append(ApplicationFrame.HELP_MENU_ID, "&MiniHelp",
                        "Simple Help")
        helpMenu.AppendSeparator()
        helpMenu.Append(ID_ABOUT, '&About', 'Tell you about me')

        menuBar.Append(fileMenu, 'File')
        menuBar.Append(helpMenu, 'Help')

        self.SetMenuBar(menuBar)

        self.Bind(EVT_MENU, self._onMiniHelp, id=ApplicationFrame.HELP_MENU_ID)
        self.Bind(EVT_MENU, self._onConfigure, id=ID_PREFERENCES)
        self.Bind(EVT_MENU, self._onAbout, id=ID_ABOUT)
        self.Bind(EVT_MENU, self.Close, id=ID_EXIT)
Esempio n. 10
0
    def __init__(self, master, resources): # resources - (file, icons)
        MenuBar.__init__(self)
        self.master = master     
         
        self.__XMLfile   = resources[0]
        self.__iconspath = resources[1]
        
        ## @var menuTree
        #
        #  holds the options for each widget		
        self.menuTree = []

        ## @var menus
        #
        #  holds the widgets in a treelike fashion
        self.menus    = [] 
        
        self.__createMenu() 
        self.master.SetMenuBar(self)
Esempio n. 11
0
    def initializeMenus(self):

        self._initializeFileMenu()
        self._initializeEditMenu()

        # -----------------
        #    Tools menu
        # -----------------
        # mnuTools = Menu()
        sub = self._makeToolsMenu()
        if sub is not None:
            self._toolsMenu.AppendSubMenu(sub, _("Tools"), _('Tools are here'))

        sub = self._makeToolboxesMenu()
        if sub is not None:
            self._toolsMenu.AppendSubMenu(sub, _("Toolboxes"),
                                          _('Toolboxes are here'))

        # Plugins identified
        self._fileMenuHandler.importPlugins = self._importPlugins
        self._fileMenuHandler.exportPlugins = self._exportPlugins

        self._initializeHelpMenu()

        mnuBar = MenuBar()
        mnuBar.Append(self._fileMenu, _("&File"))
        mnuBar.Append(self._editMenu, _("&Edit"))
        mnuBar.Append(self._toolsMenu, _("&Tools"))
        mnuBar.Append(self._helpMenu, _("&Help"))

        containingFrame: Frame = self._containingFrame
        containingFrame.SetMenuBar(mnuBar)

        self._fileMenuHandler.setLastOpenedFilesItems()

        self._bindFileMenuHandlers(containingFrame, self._fileMenuHandler)
        self._bindEditMenuHandlers(containingFrame, self._editMenuHandler)
        self._bindHelpMenuHandlers(containingFrame, self._helpMenuHandler)
Esempio n. 12
0
    def __init__(self, app: App):
        super(Frame, self).__init__(None)
        self.editor = TextCtrl(self, 101, style=TE_MULTILINE)
        self.stat: StatusBar = self.CreateStatusBar()
        self.stat.SetFieldsCount(2)
        self.stat.SetStatusWidths([-1, -5])
        self.SetTitle(f"{BASETITLE} - *Untitled*")
        self.SetSize(720, 540)
        self.File: str = None
        self.changed = False

        menubar: MenuBar = MenuBar()
        edit_menu: Menu = Menu()
        file_menu: Menu = Menu()

        edit_menu.Append(1, "&Preview\tCtrl+P")
        edit_menu.Append(2, "Post")
        edit_menu.AppendSeparator()
        edit_menu.Append(7, "&Ruby\tCtrl+R")
        edit_menu.Append(9, "&Dotmarks\tCtrl+Shift+D")
        edit_menu.Append(8, "&Paragraph\tCtrl+Space")

        file_menu.Append(3, "&New\tCtrl+N")
        file_menu.Append(4, "&Open\tCtrl+Shift+O")
        file_menu.AppendSeparator()
        file_menu.Append(5, "&Save as\tCtrl+Shift+S")
        file_menu.Append(6, "&Save\tCtrl+S")

        menubar.Append(file_menu, "&File")
        menubar.Append(edit_menu, "&Edit")

        self.SetMenuBar(menubar)
        self.Bind(EVT_MENU, self.Preview, id=1)
        self.Bind(EVT_MENU, self.Post, id=2)
        self.Bind(EVT_MENU, self.New, id=3)
        self.Bind(EVT_MENU, self.Open, id=4)
        self.Bind(EVT_MENU, self.SaveAs, id=5)
        self.Bind(EVT_MENU, self.Save, id=6)
        self.Bind(EVT_MENU, self.SetRuby, id=7)
        self.Bind(EVT_MENU, self.SetParagraphSpaces, id=8)
        self.Bind(EVT_MENU, self.Dotmarks, id=9)

        self.pvframe = HideFrame(None, -1, "プレビュー")
        self.pvctrl: WebView = WebView.New(self.pvframe)
        self.pvctrl.SetCanFocus(False)
        self.pvframe.SetCanFocus(False)
        self.Bind(EVT_TEXT, self.Reload, id=101)
        app.SetTopWindow(self)
        self.application = app
        self.Show()
Esempio n. 13
0
    def OnInit(self):

        self.InitInspection()

        frameTop: Frame = Frame(parent=None,
                                id=TestWxOgl.FRAME_ID,
                                title="Test WX Ogl",
                                size=(TestWxOgl.WINDOW_WIDTH,
                                      TestWxOgl.WINDOW_HEIGHT),
                                style=DEFAULT_FRAME_STYLE)

        OGLInitialize()

        testWindow: TestWindow = TestWindow(frameTop)

        button = Button(testWindow, 1003, "Draw Me")
        button.SetPosition((15, 15))
        self.Bind(EVT_BUTTON, self.onDrawMe, button)

        frameTop.SetSize((800, 600))
        testWindow.SetFocus()

        self.window: TestWindow = testWindow
        self.frameRect: Rect = frameTop.GetRect()

        frameTop.Bind(EVT_CLOSE, self._onCloseFrame)

        menuBar: MenuBar = MenuBar()
        menu: Menu = Menu()

        item = menu.Append(-1, "&Widget Inspector\tF6",
                           "Show the wxPython Widget Inspection Tool")
        self.Bind(wx.EVT_MENU, self.onWidgetInspector, item)

        menuBar.Append(menu, "&File")

        frameTop.SetMenuBar(menuBar)
        frameTop.Show(True)

        return True
Esempio n. 14
0
    def __init__(self, parent, dpi=(1, 1)):
        Frame.__init__(self,
                       parent,
                       id=ID_ANY,
                       title=u" mHosts - v" + Settings.version(),
                       pos=DefaultPosition,
                       size=Size(700 * dpi[0], 500 * dpi[1]),
                       style=DEFAULT_FRAME_STYLE | SYSTEM_MENU | TAB_TRAVERSAL)
        self.SetIcon(Icon(iconPath, BITMAP_TYPE_ICO))
        self.SetSizeHints(Size(500 * dpi[0], 350 * dpi[1]))
        self.menuBar = MenuBar(0)
        self.menuFile = Menu()
        self.menuItemNew = MenuItem(self.menuFile, ID_ANY, u"新建(&N)",
                                    EmptyString, ITEM_NORMAL)
        self.menuItemImport = MenuItem(self.menuFile, ID_ANY, u"导入(&I)",
                                       EmptyString, ITEM_NORMAL)
        if sys.platform != "linux":
            self.menuItemImport.Enable(False)
        self.menuFile.Append(self.menuItemNew)
        self.menuFile.Append(self.menuItemImport)

        self.menuFile.AppendSeparator()

        self.menuItemExit = MenuItem(self.menuFile, ID_ANY, u"退出(&Q)",
                                     EmptyString, ITEM_NORMAL)
        self.menuFile.Append(self.menuItemExit)

        self.menuBar.Append(self.menuFile, u"文件(&F)")

        self.menuHelp = Menu()

        self.menuItemSettings = MenuItem(self.menuHelp, ID_ANY, u"首选项(&P)",
                                         EmptyString, ITEM_NORMAL)
        if sys.platform != "linux":
            self.menuItemSettings.Enable(False)
        self.menuHelp.Append(self.menuItemSettings)

        self.menuItemHelpDoc = MenuItem(self.menuHelp, ID_ANY, u"帮助文档(&D)",
                                        EmptyString, ITEM_NORMAL)
        self.menuHelp.Append(self.menuItemHelpDoc)

        self.menuItemCheckUpdate = MenuItem(self.menuHelp, ID_ANY, u"检查更新(&U)",
                                            EmptyString, ITEM_NORMAL)
        self.menuHelp.Append(self.menuItemCheckUpdate)

        self.menuItemAbout = MenuItem(self.menuHelp, ID_ANY, u"关于(&A)",
                                      EmptyString, ITEM_NORMAL)
        self.menuHelp.Append(self.menuItemAbout)

        self.menuBar.Append(self.menuHelp, u"帮助(&H)")

        self.SetMenuBar(self.menuBar)

        self.statusBar = StatusBar(self, ID_ANY, STB_SIZEGRIP)
        statusBarFont = Font(10, FONTFAMILY_DEFAULT, FONTSTYLE_NORMAL,
                             FONTWEIGHT_NORMAL, False, EmptyString)
        self.statusBar.SetFont(statusBarFont)
        self.SetStatusBar(self.statusBar)

        bSizer1 = BoxSizer(HORIZONTAL)

        self.images = {}

        self.imageList = ImageList(width=12, height=12)
        iconList = GetIcons().items()
        for name, bitmap in iconList:
            self.images[name] = self.imageList.Add(bitmap)

        self.hostsTree = TreeCtrl(self, ID_ANY, Point(0, 0),
                                  Size(180 * dpi[0], -1), TR_DEFAULT_STYLE)
        self.hostsTree.SetImageList(self.imageList)
        bSizer1.Add(self.hostsTree, 0, EXPAND, 5)

        # self.hostsListView = CheckListBox(self, size=Size(size[0] / 9, -1))
        # bSizer1.Add(self.hostsListView, 0, EXPAND, 5)

        # WARNING: wxPython code generation isn't supported for this widget yet.
        self.codeEditor = CodeView(self, dpi)
        bSizer1.Add(self.codeEditor, 1, EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(BOTH)

        # Connect Events
        self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemNew.GetId())
        self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemExit.GetId())
        self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemAbout.GetId())
        self.Bind(EVT_MENU,
                  self.OnMenuClicked,
                  id=self.menuItemHelpDoc.GetId())
        self.Bind(EVT_MENU,
                  self.OnMenuClicked,
                  id=self.menuItemSettings.GetId())
        self.Bind(EVT_MENU, self.OnMenuClicked, id=self.menuItemImport.GetId())
        self.Bind(EVT_MENU,
                  self.OnMenuClicked,
                  id=self.menuItemCheckUpdate.GetId())
Esempio n. 15
0
 def __init__(self):
     MenuBar.__init__(self)
     self.construct_gui()
Esempio n. 16
0
 def __init__(self):
     MenuBar.__init__(self)
     
     self.Append(Menus.File(self),"&File")
     self.Append(Menus.View(self), "&View")
Esempio n. 17
0
    def initMenus(self):

        self.mnuFileNew = Menu()
        self.mnuFileNew.Append(SharedIdentifiers.ID_MNUFILENEWPROJECT,         _("&New project\tCtrl-N"), _("New project"))
        self.mnuFileNew.Append(SharedIdentifiers.ID_MNU_FILE_NEW_CLASS_DIAGRAM, _("New c&lass diagram\tCtrl-L"), _("New class diagram"))
        self.mnuFileNew.Append(SharedIdentifiers.ID_MNU_FILE_NEW_SEQUENCE_DIAGRAM, _("New s&equence diagram\tCtrl-E"), _("New sequence diagram"))
        self.mnuFileNew.Append(SharedIdentifiers.ID_MNU_FILE_NEW_USECASE_DIAGRAM, _("New &use-case diagram\tCtrl-U"), _("New use-case diagram"))

        self.fileMenu.Append(NewId(), _("&New"), self.mnuFileNew)
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_INSERT_PROJECT, _("&Insert a project...\t"), _("Insert a project in the current project..."))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_OPEN, _("&Open...\tCtrl-O"), _("Open a file..."))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_SAVE, _("&Save\tCtrl-S"), _("Save current data"))
        self.fileMenu.Append(SharedIdentifiers.ID_MNUFILESAVEAS, _("Save &As...\tCtrl-A"), _("Save current data"))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_PROJECT_CLOSE, _("&Close project\tCtrl-W"), _("Close current project"))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_REMOVE_DOCUMENT, _("&Remove document"), _("Remove the document from the project"))
        self.fileMenu.AppendSeparator()

        sub = self.makeExportMenu()

        if sub is None:
            sub = Menu()

        if sub is not None:
            self.fileMenu.Append(NewId(), _("Export"), sub)

        sub = self.makeImportMenu()
        if sub is not None:
            self.fileMenu.Append(NewId(), _("Import"), sub)

        self.fileMenu.AppendSeparator()
        self.fileMenu.Append(SharedIdentifiers.ID_MENU_FILE_PYUT_PREFERENCES, _("PyUt P&references"), _("PyUt preferences"))
        # self.fileMenu.Append(ID_MNU_FILE_DIAGRAM_PROPERTIES,_("&Diagram Properties"), _("Diagram properties"))
        self.fileMenu.AppendSeparator()
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_PRINT_SETUP, _("Print se&tup..."), _("Display the print setup dialog box"))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_PRINT_PREVIEW, _("Print pre&view"), _("Diagram preview before printing"))
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_PRINT, _("&Print\tCtrl-P"), _("Print the current diagram"))
        self.fileMenu.AppendSeparator()

        #  Add Last opened files
        index = 0
        #  TODO : does not work ? verify function return...
        for el in self._prefs.getLastOpenedFilesList():
            index += 1
            # self.fileMenu.Append(self.lastOpenedFilesID[index - 1], "&" + str(index) + " " + el)
            lof: str = f"&{str(index)} {el}"
            self.logger.debug(f'self.lastOpenedFilesID[index - 1]: {self.lastOpenedFilesID[index - 1]}  lof: {lof}  ')
            self.fileMenu.Append(self.lastOpenedFilesID[index - 1], lof)

        for index in range(index, self._prefs.getNbLOF()):
            # self.fileMenu.Append(self.lastOpenedFilesID[index], "&" + str(index + 1) + " -")
            lofAgain: str = f"&{str(index + 1)} -"
            self.fileMenu.Append(self.lastOpenedFilesID[index], lofAgain)

        self.fileMenu.AppendSeparator()
        self.fileMenu.Append(SharedIdentifiers.ID_MNU_FILE_EXIT, _("E&xit"), _("Exit PyUt"))

        mnuEdit = Menu()

        mnuEdit.Append(SharedIdentifiers.ID_MNU_UNDO, _("&Undo\tCtrl-Z"), _("Undo the last performed action"))
        mnuEdit.Append(SharedIdentifiers.ID_MNU_REDO, _("&Redo\tCtrl-Y"), _("Redo the last undone action"))
        mnuEdit.AppendSeparator()
        mnuEdit.Append(SharedIdentifiers.ID_MNU_EDIT_CUT, _("Cu&t\tCtrl-X"), _("Cut selected data"))
        mnuEdit.Append(SharedIdentifiers.ID_MNU_EDIT_COPY, _("&Copy\tCtrl-C"), _("Copy selected data"))
        mnuEdit.Append(SharedIdentifiers.ID_MNU_EDIT_PASTE, _("&Paste\tCtrl-V"), _("Paste selected data"))
        mnuEdit.AppendSeparator()
        mnuEdit.Append(SharedIdentifiers.ID_MNU_EDIT_SELECT_ALL, _("&Select all"), _("Select all elements"))
        mnuEdit.AppendSeparator()
        mnuEdit.Append(SharedIdentifiers.ID_MNU_ADD_PYUT_HIERARCHY, _("&Add Pyut hierarchy"), _("Add the UML Diagram of Pyut"))
        mnuEdit.Append(SharedIdentifiers.ID_MNU_ADD_OGL_HIERARCHY, _("Add &Ogl hierarchy"), _("Add the UML Diagram of Pyut - Ogl"))
        if MenuCreator.DEBUG_ERROR_VIEWS is True:
            mnuEdit.AppendSeparator()
            mnuEdit.Append(SharedIdentifiers.ID_MENU_GRAPHIC_ERROR_VIEW, 'Show &Graphic Error View',  'Test graphical error view')
            mnuEdit.Append(SharedIdentifiers.ID_MENU_TEXT_ERROR_VIEW,    'Show &Text Error View',     'Test text error view')
            mnuEdit.Append(SharedIdentifiers.ID_MENU_RAISE_ERROR_VIEW,   'Show &Exception Error View', 'Test raising exception')
        # -----------------
        #    Tools menu
        # -----------------
        mnuTools = Menu()
        sub = self.makeToolsMenu()
        if sub is not None:
            mnuTools.Append(NewId(), _("Plugins tools"), sub)

        sub = self.makeToolboxesMenu()
        if sub is not None:
            mnuTools.Append(NewId(), _("toolboxes"), sub)

        mnuHelp = Menu()
        mnuHelp.Append(SharedIdentifiers.ID_MNU_HELP_INDEX, _("&Index"), _("Display help index"))
        mnuHelp.AppendSeparator()
        mnuHelp.Append(SharedIdentifiers.ID_MNU_HELP_VERSION, _("Check for newer versions"), _("Check if a newer version of Pyut exists"))
        mnuHelp.Append(SharedIdentifiers.ID_MNU_HELP_WEB, _("&Web site"), _("Open PyUt web site"))
        mnuHelp.Append(SharedIdentifiers.ID_DEBUG,      _("&Debug"), _("Open IPython shell"))
        mnuHelp.AppendSeparator()
        mnuHelp.Append(SharedIdentifiers.ID_MNU_HELP_ABOUT, _("&About PyUt..."), _("Display the About PyUt dialog box"))

        mnuBar = MenuBar()
        mnuBar.Append(self.fileMenu, _("&File"))
        mnuBar.Append(mnuEdit, _("&Edit"))
        mnuBar.Append(mnuTools, _("&Tools"))
        mnuBar.Append(mnuHelp, "&?")

        containingFrame: Frame = self._containingFrame
        containingFrame.SetMenuBar(mnuBar)

        cb: SharedTypes.CallbackMap = self._callbackMap

        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.NEW_PROJECT],       id=SharedIdentifiers.ID_MNUFILENEWPROJECT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.NEW_CLASS_DIAGRAM], id=SharedIdentifiers.ID_MNU_FILE_NEW_CLASS_DIAGRAM)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.NEW_SEQUENCE_DIAGRAM], id=SharedIdentifiers.ID_MNU_FILE_NEW_SEQUENCE_DIAGRAM)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.NEW_USE_CASE_DIAGRAM], id=SharedIdentifiers.ID_MNU_FILE_NEW_USECASE_DIAGRAM)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.INSERT_PROJECT], id=SharedIdentifiers.ID_MNU_FILE_INSERT_PROJECT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.FILE_OPEN], id=SharedIdentifiers.ID_MNU_FILE_OPEN)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.FILE_SAVE], id=SharedIdentifiers.ID_MNU_FILE_SAVE)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.FILE_SAVE_AS],    id=SharedIdentifiers.ID_MNUFILESAVEAS)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PROJECT_CLOSE],   id=SharedIdentifiers.ID_MNU_PROJECT_CLOSE)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.REMOVE_DOCUMENT], id=SharedIdentifiers.ID_MNU_FILE_REMOVE_DOCUMENT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PRINT_SETUP], id=SharedIdentifiers.ID_MNU_FILE_PRINT_SETUP)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PRINT_PREVIEW], id=SharedIdentifiers.ID_MNU_FILE_PRINT_PREVIEW)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PRINT], id=SharedIdentifiers.ID_MNU_FILE_PRINT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PYUT_PREFERENCES], id=SharedIdentifiers.ID_MENU_FILE_PYUT_PREFERENCES)
        #  EVT_MENU(self, ID_MNU_FILE_DIAGRAM_PROPERTIES,self._OnMnuFileDiagramProperties)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.EXIT_PROGRAM], id=SharedIdentifiers.ID_MNU_FILE_EXIT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.PROGRAM_ABOUT], id=SharedIdentifiers.ID_MNU_HELP_ABOUT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.HELP_INDEX], id=SharedIdentifiers.ID_MNU_HELP_INDEX)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.HELP_VERSION], id=SharedIdentifiers.ID_MNU_HELP_VERSION)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.HELP_WEB], id=SharedIdentifiers.ID_MNU_HELP_WEB)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.ADD_PYUT_HIERARCHY], id=SharedIdentifiers.ID_MNU_ADD_PYUT_HIERARCHY)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.ADD_OGL_HIERARCHY], id=SharedIdentifiers.ID_MNU_ADD_OGL_HIERARCHY)

        if MenuCreator.DEBUG_ERROR_VIEWS is True:
            from org.pyut.experimental.DebugErrorViews import DebugErrorViews
            containingFrame.Bind(EVT_MENU, DebugErrorViews.debugGraphicErrorView, id=SharedIdentifiers.ID_MENU_GRAPHIC_ERROR_VIEW)
            containingFrame.Bind(EVT_MENU, DebugErrorViews.debugTextErrorView,    id=SharedIdentifiers.ID_MENU_TEXT_ERROR_VIEW)
            containingFrame.Bind(EVT_MENU, DebugErrorViews.debugRaiseErrorView,   id=SharedIdentifiers.ID_MENU_RAISE_ERROR_VIEW)

        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.EDIT_CUT], id=SharedIdentifiers.ID_MNU_EDIT_CUT)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.EDIT_COPY], id=SharedIdentifiers.ID_MNU_EDIT_COPY)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.EDIT_PASTE], id=SharedIdentifiers.ID_MNU_EDIT_PASTE)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.SELECT_ALL], id=SharedIdentifiers.ID_MNU_EDIT_SELECT_ALL)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.DEBUG],         id=SharedIdentifiers.ID_DEBUG)

        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.UNDO], id=SharedIdentifiers.ID_MNU_UNDO)
        containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.REDO], id=SharedIdentifiers.ID_MNU_REDO)

        for index in range(self._prefs.getNbLOF()):
            containingFrame.Bind(EVT_MENU, cb[ActionCallbackType.LAST_OPENED_FILES], id=self.lastOpenedFilesID[index])

        containingFrame.Bind(EVT_CLOSE, cb[ActionCallbackType.CLOSE])
Esempio n. 18
0
    def __init__(self,
        logging = False,
        logFile = None,
    ):
        super(SaveMonitor, self).__init__(None,
            title = "Game Save Monitor"
        )

        menuBar = MenuBar()

        fileMenu = Menu()
        addItem = fileMenu.Append(ID_NEW, "&Add",
            "Add save data backup settings"
        )
        self.Bind(EVT_MENU, self._on_add, addItem)
        menuBar.Append(fileMenu, "&File")

        self.showMenu = Menu()
        menuBar.Append(self.showMenu, "&Show")

        debugMenu = Menu()
        menuBar.Append(debugMenu, "&Debug")

        self._logging = None
        self.loggingItem = debugMenu.Append(ID_FILE,
            "&Logging",
            "Save program output to file",
            ITEM_CHECK
        )
        self.Bind(EVT_MENU, self._on_log, self.loggingItem)

        aboutMenu = Menu()
        aboutItem = aboutMenu.Append(ID_ABOUT,
            "&About", "Information about this program"
        )
        self.Bind(EVT_MENU, self._on_about, aboutItem)
        menuBar.Append(aboutMenu, "&About")

        self.SetMenuBar(menuBar)

        self.root2threads = {}
        self.settings = []

        self.mainSizer = mainSizer = BoxSizer(VERTICAL)

        mainSizer.SetSizeHints(self)
        self.SetSizer(mainSizer)

        self.Bind(EVT_CLOSE, self._on_close, self)

        self._logFile = logFile
        if logFile is None:
            stream = NullStream()
        else:
            try:
                stream = open(logFile, "a+")
            except:
                print_exc()
                print("Cannot log to %s" % logFile)
                stream = NullStream()

        self._logStream = stream

        self.logging = logging