def showToolBar(self, size): # Current version of wxPython (2.7.8.1) has a bug # (https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1742682&group_id=9863) # that makes adding controls to a toolbar not working. Also, when the # toolbar is visible it's nearly impossible to enter text into text # controls. Immediately after you click on a text control the focus # is removed. We work around it by not having AUI manage the toolbar # on Mac OS X: if '__WXMAC__' in wx.PlatformInfo: if self.GetToolBar(): self.GetToolBar().Destroy() if size is not None: self.SetToolBar(toolbar.ToolBar(self, size=size)) self.SendSizeEvent() else: currentToolbar = self.manager.GetPane('toolbar') if currentToolbar.IsOk(): self.manager.DetachPane(currentToolbar.window) currentToolbar.window.Destroy() if size: bar = toolbar.ToolBar(self, size=size) self.manager.AddPane( bar, aui.AuiPaneInfo().Name('toolbar').Caption('Toolbar'). ToolbarPane().Top().DestroyOnClose().LeftDockable( False).RightDockable(False)) self.manager.Update()
def create_toolbar(self, type): if type == "right": self.inspector = inspector.Inspector(self) inspectorToolbar = QtGui.QToolBar() inspectorToolbar.addWidget(self.inspector) self.addToolBar(QtCore.Qt.RightToolBarArea, inspectorToolbar) elif type == "top": self.addToolBar(toolbar.ToolBar(self))
def __init__(self, needs_render_window): """Constructor. Initializes the application main window and restores the previous run. """ wx.MDIParentFrame.__init__(self, None, -1, "Conjurer GUI", size=(1024, 768)) # window icon file_server = servers.get_file_server() icon_path = file_server.manglepath("outgui:images/conjurer.ico") self.SetIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO)) # Let the InGUI know that the OutGUI is open pynebula.new('nroot', '/editor/outguiisopened') self.quit_without_saving = False self.quit_requested = False # create a render window if required if needs_render_window: self.render_window = renderwindow.CreateWindow(self) parent_hwnd_env = pynebula.new('nenv', '/sys/env/hwnd') parent_hwnd_env.seti(self.render_window.GetPanelHandle()) else: self.render_window = None # preparing repository nebulaguisettings.Repository # toggable window manager self.togwinmgr = togwin.ToggableWindowMgr(self) # menu bar self.__menubar = menubar.MenuBar(self) self.__menubar.create() self.SetMenuBar(self.__menubar) # status bar self.__statusbar = statusbar.StatusBar(self) self.__statusbar.create() self.SetStatusBar(self.__statusbar) # tool bar self.__toolbar = toolbar.ToolBar(self) self.__toolbar.create() self.SetToolBar(self.__toolbar) self.__toolbar.Realize() # events self.Bind(wx.EVT_CLOSE, self.on_close_window) self.Bind(nh.EVT_CONJURER_HELP, self.on_conjurer_help) # TODO: Delete when found a direct way to know the mouse position self.__mouse_position = wx.Point(0, 0) self.__toolbar.Bind(wx.EVT_LEFT_UP, self.__on_left_click)
def __init__(self): super(MainWindow, self).__init__( ) #parent=None, flags=QtCore.Qt.FramelessWindowHint) self.read_settings() self.icon = QtGui.QIcon(os.path.join('images', 'icon.png')) if self.mode == "python": self.folder_sprite = "images/open.png" self.file_sprite = "images/new.png" self.extension_sprite = "images/extensions.png" self.settings_sprite = "images/settings.png" self.resourcelist = resourcelist.ResourceList(self) self.font = QtGui.QFont() self.font.setFamily(self.font_name) self.font.setStyleHint(QtGui.QFont.Monospace) self.font.setFixedPitch(True) self.output = QtGui.QTextEdit() self.output.setReadOnly(True) self.output.setFont(self.font) #Inspector self.inspector = inspector.Inspector(self) self.mdi = QtGui.QMdiArea() if self.tabbed_view: self.mdi.setViewMode(self.mdi.TabbedView) self.mdi.setTabsClosable(True) self.mdi.setTabsMovable(True) self.mdi.setBackground( QtGui.QBrush( QtGui.QPixmap(os.path.join('images', 'background.png')))) self.toolBar = self.addToolBar(toolbar.ToolBar(self)) #self.vsplitter = QtGui.QSplitter(QtCore.Qt.Vertical) #self.vsplitter.addWidget(self.mdi) #self.vsplitter.addWidget(self.output) self.splitter = QtGui.QSplitter(QtCore.Qt.Horizontal) self.splitter.addWidget(self.resourcelist) self.splitter.addWidget(self.mdi) self.inspectorToolbar = QtGui.QToolBar() self.addToolBar(QtCore.Qt.RightToolBarArea, self.inspectorToolbar) self.inspectorToolbar.addWidget(self.inspector) self.setCentralWidget(self.splitter) self.setWindowTitle("Stellar - " + os.path.basename(self.projectdir)) self.resize(int(self.size.split("x")[0]), int(self.size.split("x")[1])) self.statusBar().showMessage('Ready', 2000) #self.ShowProjectOverview() self.show()
def __init__(self, master): super().__init__(master) self.grid(row=0, column=0) self.current_directory = SETTINGS["default"]["current_directory"] # create the toolbar self.toolbar = toolbar.ToolBar(master) self.toolbar.button_grid = {"pady": 8, "padx": (8, 0)} self.toolbar.append(name="new", label="Nuevo", command=self.new_wheel, image=BASE / "images" / "new.png") self.toolbar.append(name="open", label="Abrir", command=self.open_wheel, image=BASE / "images" / "open.png") self.toolbar.append(name="save", label="Guardar", command=self.save_changes, image=BASE / "images" / "save.png") self.toolbar.append(name="save_as", label="Guardar como", command=self.save_wheel, image=BASE / "images" / "save_as.png") self.toolbar.append(name="undo", label="Deshacer", command=self.undo, image=BASE / "images" / "undo.png") self.toolbar.append(name="redo", label="rehacer", command=self.redo, image=BASE / "images" / "redo.png") self.toolbar.grid(row=0, column=0, sticky=tk.W + tk.E) # create an inner frame to center the widgets self.notebook = widgets.ClosableNotebook( master=master, check_unsaved=True, confirm_close=lambda data: self.save_changes(index=data)) self.notebook.grid(row=1, column=0, sticky=tk.W) self.set_events() if SETTINGS["default"]["opened_files"]: for i in SETTINGS["default"]["opened_files"].split(","): self.open_wheel(path=i) else: self.new_wheel()
def __init__(self): super(MainWindow, self).__init__() self.projectdir = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'example') self.eeldir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'eel', 'eel') if sys.platform == "win32": self.eeldir += '.exe' self.treeView = treeview.TreeView(self) self.output = QtGui.QTextEdit() self.output.setReadOnly(True) self.font = QtGui.QFont() self.font.setFamily('Monaco') self.font.setStyleHint(QtGui.QFont.Monospace) self.font.setFixedPitch(True) self.output.setFont(self.font) self.mdi = QtGui.QMdiArea() self.mdi.setViewMode(self.mdi.TabbedView) self.mdi.setTabsClosable(True) self.mdi.setTabsMovable(True) backf = QtGui.QBrush( QtGui.QPixmap(os.path.join('images', 'background.png'))) self.mdi.setBackground(backf) self.toolBar = self.addToolBar(toolbar.ToolBar(self)) self.statusBar().showMessage('Ready', 2000) self.vsplitter = QtGui.QSplitter(QtCore.Qt.Vertical) self.vsplitter.addWidget(self.mdi) self.vsplitter.addWidget(self.output) self.output.hide() self.c_displayed = False splitter = QtGui.QSplitter(QtCore.Qt.Horizontal) splitter.addWidget(self.treeView) splitter.addWidget(self.vsplitter) self.setCentralWidget(splitter) self.setWindowTitle("Stellar - " + os.path.basename(self.projectdir)) self.resize(640, 480) self.show()
def setUpClass(cls): cls.master = tk.Tk() cls.toolbar = toolbar.ToolBar(cls.master) cls.toolbar.grid()
def __init__(self, app, session=None): wx.Frame.__init__(self, None, -1, "Write++", app.settings["WindowPos"], app.settings["WindowSize"]) self._app = app self.dragsource = -1 self.editor = None self.filetypes = "|".join(filters) self.new = 0 self.managers = {} self.panedict = {} self.rect = wx.Rect(app.settings["WindowPos"], app.settings["WindowSize"]) self.results = 0 self.search = search.SearchSystem(self) self.session = session self.styler = syntax.Styler(self) icons = wx.IconBundle() icons.AddIcon(os.path.join(app.cwd, "images", "write++-16.png"), wx.BITMAP_TYPE_PNG) icons.AddIcon(os.path.join(app.cwd, "images", "write++-32.png"), wx.BITMAP_TYPE_PNG) self.SetIcons(icons) if app.settings["BackupType"] == 2 and (not os.path.isdir( app.settings["BackupDir"])): os.makedirs(app.settings["BackupDir"]) for direction in (wx.LEFT, wx.RIGHT, wx.TOP, wx.BOTTOM): self.managers[direction] = panes.VCPaneManager(self, direction) if not self.session: self.session = app.settings["SessionFile"] firstrun = not len(self.session) if not os.path.isfile(self.session): self.session = os.path.join(app.userdatadir, "Default.write++") self.aui = aui.AuiManager( self, aui.AUI_MGR_DEFAULT | aui.AUI_MGR_USE_NATIVE_MINIFRAMES) dockart = self.aui.GetArtProvider() dockart._inactive_minimize_bitmap = dockart._inactive_pin_bitmap.ConvertToImage( ).Rotate90().ConvertToBitmap() dockart.SetFont(aui.AUI_DOCKART_CAPTION_FONT, self.GetFont()) self.menubar = menu.MenuBar(self) self.SetMenuBar(self.menubar) self.toolbar = toolbar.ToolBar(self) self.aui.AddPane( self.toolbar, aui.AuiPaneInfo().Name("toolbar").ToolbarPane().PaneBorder( False).Top().Row(1)) self.statusbar = self.CreateStatusBar(6) self.statusbar.SetStatusWidths( [-8, -2, -4, -1, -1, self.statusbar.GetTextExtent("OVR")[0] + 8]) self.notebook = notebook.MainNotebook(self) self.aui.AddPane( self.notebook, aui.AuiPaneInfo().Name("notebook").CenterPane().PaneBorder(False)) self.filebrowser = panes.FileBrowser(self) x, y, width, height = self.filebrowser.toolbar.GetToolRect( self.filebrowser.ID_OPTIONS) self.managers[wx.LEFT].AddPane(self.filebrowser, _("File Browser"), self.Bitmap("file-browser"), "filebrowser", x + width + 5) self.searchbar = toolbar.SearchBar(self) self.aui.AddPane( self.searchbar, aui.AuiPaneInfo().Name("searchbar").ToolbarPane().Gripper( False).Resizable().Bottom().Layer(0).DockFixed().Hide()) app.plugins.OnInit(self) filename = os.path.join(app.userdatadir, "write++.aui") if os.path.isfile(filename): perspective = open(filename, 'r') self.aui.LoadPerspective(perspective.read()) perspective.close() if len(app.frames) == 0 or session: self.LoadSession(self.session) else: self.statusbar.SetStatusText(_("untitled"), 1) self.session = "" if firstrun: welcome = os.path.join(app.cwd, "locale", app.locale.GetCanonicalName(), "readme.txt") if not os.path.isfile(welcome): welcome = os.path.join(app.cwd, "locale", "en_US", "readme.txt") self.OpenFile(welcome) editor = self.GetEditor() editor.filename = _("Welcome!") editor.new = True editor.SetReadOnly(True) editor.OnSavePointReached(None) elif not self.notebook.GetPageCount(): self.New() self.GetEditor().SetFocus() for i in self.managers: if len(self.managers[i].panes): self.managers[i].Realize() self.menubar.View.Check(self.menubar.ID_TOOLBAR, self.aui.GetPane("toolbar").IsShown()) for pane in self.panedict: manager = self.managers[self.panedict[pane]] self.menubar.View.Check( getattr(self.menubar, "ID_%s" % pane.upper()), pane in manager.visible) self.searchbar.SetGripperVisible(False) self.aui.Update() if app.settings["MaximizeState"]: self.Maximize() self.Layout() app.plugins.PostInit(self) self.aui.Bind(aui.EVT_AUI_PANE_BUTTON, self.OnAuiPaneButton) self.Bind(wx.EVT_ACTIVATE, self.OnActivate) self.Bind(wx.EVT_MOVE, self.OnMove) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_ICONIZE, self.OnIconize) self.Bind(wx.EVT_CLOSE, self.OnClose)