def __init__(self, ID, size, parent = None, **args): """constructor for the base WaxEditFrame class **INPUTS** *wx.WindowID ID* -- the wx.Windows ID for the frame window *wx.Size or (INT, INT) size* -- initial size for the frame *wx.Window parent* -- the parent window, if any (usually not for single-frame applications) """ self.deep_construct( WaxFrameBase, {'closing': 0, 'ID': ID }, args, exclude_bases = {wx.Frame: 1}, enforce_value = {'ID': ID} ) wx.Frame.__init__(self, parent, self.ID, self.app_name, wx.DefaultPosition, size) file_menu=wx.Menu() ID_OPEN_FILE = wx.NewId() ID_SAVE_FILE = wx.NewId() ID_SAVE_AS = wx.NewId() ID_EXIT = wx.NewId() ID_CLOSE_MENU = wx.NewId() # print ID_OPEN_FILE file_menu.Append(ID_OPEN_FILE,"&Open...","Open a file") file_menu.Append(ID_SAVE_FILE,"&Save","Save current file") file_menu.Append(ID_SAVE_AS,"Save &As...","Save current file") file_menu.Append(ID_CLOSE_MENU,"&Close","Close window") file_menu.Append(ID_EXIT,"E&xit","Terminate") ID_CHOOSE_FONT = wx.NewId() format_menu = wx.Menu() format_menu.Append(ID_CHOOSE_FONT, "&Font...") edit_menu = wx.Menu() menuBar=wx.MenuBar() wx.EVT_CLOSE(self, self.on_close) menuBar.Append(file_menu,"&File"); menuBar.Append(edit_menu,"&Edit"); menuBar.Append(format_menu,"F&ormat"); # menuBar.Append(window_menu, "&Window"); self.CreateStatusBar() self.SetMenuBar(menuBar) wx.EVT_MENU(self, ID_EXIT, self.quit_now) wx.EVT_MENU(self, ID_CLOSE_MENU, self.close_now) wx.EVT_MENU(self, ID_OPEN_FILE, self.on_open_file) wx.EVT_MENU(self, ID_SAVE_FILE,self.on_save) wx.EVT_MENU(self, ID_SAVE_AS,self.on_save_as) wx.EVT_MENU(self, ID_CHOOSE_FONT, self.choose_font) wx.EVT_ACTIVATE(self, self.OnActivate) self.most_recent_focus = None
def __init__(self, editor): """ Initializes the object. """ wx.Frame.__init__(self, editor.control, -1, '', style=wx.SIMPLE_BORDER) self.SetBackgroundColour(WindowColor) wx.EVT_ACTIVATE(self, self._on_close_dialog) self._closed = False dlg_editor = CustomEditor(self, factory=editor.factory, ui=editor.ui, object=editor.object, name=editor.name, description=editor.description, update_handler=self._close_dialog) dlg_editor.init(self) # Wrap the dialog around the image button panel: sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(dlg_editor.control) sizer.Fit(self) # Position the dialog: position_window(self, parent=editor.control) self.Show()
def _close_popup(self): """ Closes the dialog. """ wx.EVT_ACTIVATE(self.popup, None) self.dispose() self.closed = True self.popup.Destroy() self.popup = self.control = None
def __init__(self, titre): wx.Frame.__init__(self, None, -1, title=titre, style=wx.CLOSE_BOX | wx.MINIMIZE_BOX, size=(520, 290)) self.i = 0 #self.timer = wx.Timer(self, 1) self.SetIcon( wx.Icon(Variables.playonlinux_env + "/etc/playonlinux.png", wx.BITMAP_TYPE_ANY)) self.panelFenp = wx.Panel(self, -1) self.fontTexte = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False, "", wx.FONTENCODING_DEFAULT) self.txtTitre = wx.StaticText(self.panelFenp, -1, Variables.titre, (20, 25), wx.DefaultSize, wx.ALIGN_CENTER) self.txtTitre.SetFont(self.fontTexte) self.txtTexte = wx.StaticText(self.panelFenp, -1, _("Click Download to start."), (155, 120), wx.DefaultSize) self.txtTexte.Wrap(330) if Variables.nombreEtape != "0": self.txtEtape = wx.StaticText(self.panelFenp, -1, Variables.etape_txt, (20, 265), wx.DefaultSize) self.buttonSuivant = wx.Button( self.panelFenp, ID_NEXT, _("Please wait while the software is being downloaded..."), (425, 250), wx.DefaultSize) if Variables.cancel_present == "1": self.buttonAnnuler = wx.Button(self.panelFenp, ID_CANCEL, _("Cancel"), (330, 250), wx.DefaultSize) self.imageLogo = wx.Bitmap(Variables.image_use) self.canvasLogo = wx.StaticBitmap(self.panelFenp, -1, self.imageLogo, (30, 65), wx.DefaultSize) self.progressBar = wx.Gauge(self.panelFenp, -1, 100, (155, 70), (245, 17), style=wx.GA_HORIZONTAL) self.txtEstimation = wx.StaticText(self.panelFenp, -1, Variables.estimation_txt, (155, 90), wx.DefaultSize) #self.Bind(wx.EVT_TIMER, self.DownloadFile(Variables.url, Variables.localB), self.timer) #self.timer.Start(1000) #Evenements wx.EVT_BUTTON(self, ID_CANCEL, self.Cancel) wx.EVT_BUTTON(self, ID_NEXT, self.Next) if (Variables.next == "1"): wx.EVT_ACTIVATE(self, self.Next)
def _on_ok(self, event=None): """ Handles the user clicking the **OK** button. """ if self.ui.handler.close(self.ui.info, True): wx.EVT_ACTIVATE(self.control, None) self.close(wx.ID_OK) return True return False
def __init__(self, app, filenames): self.initmixin() self.app = app self.pref = app.pref self.filenames = filenames self.closeflag = False self.callplugin_once('start', self) wx.Frame.__init__(self, None, -1, self.app.appname, size=wx.Size(600, 400), name=self.app.appname) Globals.mainframe = self #@add_menu menulist self.callplugin_once('add_menu', MainFrame.menulist) #@add_menu_image_list self.callplugin_once('add_menu_image_list', MainFrame.imagelist) #@add_filewildchar filewildchar self.callplugin_once('add_filewildchar', MainFrame.filewildchar) #@add_tool_list self.callplugin_once('add_tool_list', MainFrame.toollist, MainFrame.toolbaritems) #@add_new_files self.callplugin_once('add_new_files', MainFrame.filenewtypes) self.id = self.GetId() self.menubar=makemenu.makemenu(self, self.menulist, MainFrame.accellist, MainFrame.editoraccellist, MainFrame.imagelist) self.SetMenuBar(self.menubar) a = {} self.callplugin_once('init_accelerator', self, MainFrame.accellist, MainFrame.editoraccellist) a.update(MainFrame.accellist) a.update(MainFrame.editoraccellist) MainFrame.default_accellist = copy.deepcopy(MainFrame.accellist) MainFrame.default_editoraccellist = copy.deepcopy(MainFrame.editoraccellist) self.editorkeycodes = {} Accelerator.getkeycodes(self.editoraccellist, self.editorkeycodes) makemenu.setmenutext(self, a) Accelerator.initaccelerator(self, MainFrame.accellist) self.statusbar = MyStatusBar.MyStatusBar(self) self.SetStatusBar(self.statusbar) self.progressbar = self.statusbar.g1 self.callplugin('beforeinit', self) self.callplugin('init', self) self.callplugin('show', self) wx.EVT_IDLE(self, self.OnIdle) wx.EVT_CLOSE(self, self.OnClose) wx.EVT_ACTIVATE(self, self.OnActive)
def __init__(self, **traits): """ Initializes the object. """ super(PopupControl, self).__init__(**traits) style = wx.SIMPLE_BORDER if self.resizable: style = wx.RESIZE_BORDER self.popup = popup = wx.Frame(None, -1, '', style=style) wx.EVT_ACTIVATE(popup, self._on_close_popup) self.create_control(popup) self._position_control() popup.Show()
def __init__(self, *args, **kw): wx.Frame.__init__(*(self, ) + args, **kw) #self.SetTitle("Enable Demo") self.SetAutoLayout(True) # Create the subclass's window self.enable_win = self._create_window() # Listen for the Activate event so we can restore keyboard focus. wx.EVT_ACTIVATE(self, self._on_activate) sizer = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(self.enable_win.control, 1, wx.EXPAND) self.SetSizer(sizer) self.Show(True) return
def __init__(self, editor): """ Initializes the object. """ wx.Frame.__init__(self, editor.control, -1, '', style=wx.SIMPLE_BORDER) wx.EVT_ACTIVATE(self, self._on_close_dialog) self._closed = False self._closeable = True panel = color_editor_for(editor, self, self._close_dialog) self._swatch_editor = panel._swatch_editor sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(panel) self.SetSizerAndFit(sizer) position_window(self, parent=editor.control) self.Show()
def __init__(self, parent, name, hasStatusBar=True): self.m_parent = parent self.m_name = name self.SetAutoLayout(True) self._config = {} # icon self.SetIcon( wx.Icon(os.path.join(itrade_config.dirRes, "itrade.ico"), wx.BITMAP_TYPE_ICO)) # focus self.m_hasFocus = True wx.EVT_ACTIVATE(self, self._OnActivate) # size and position wx.EVT_ICONIZE(self, self._OnMinimize) # a Statusbar in the bottom of the window if hasStatusBar: self.CreateStatusBar() # restore position/size/... self.loadConfig()
def _add_event_listeners(self): wx.EVT_ACTIVATE(self.control, self._wx_on_activate) wx.EVT_CLOSE(self.control, self._wx_on_close) wx.EVT_SIZE(self.control, self._wx_on_control_size) wx.EVT_MOVE(self.control, self._wx_on_control_move) wx.EVT_CHAR(self.control, self._wx_on_char)