def __init__(self, pos, size): wx.Frame.__init__(self, None, -1, 'XRCed', pos, size) bar = self.CreateStatusBar(2) bar.SetStatusWidths([-1, 40]) if wx.Platform != '__WXMAC__': self.icns = wx.IconBundleFromIcon(images.getIconIcon()) self.SetIcons(self.icns) self.InitMenuBar() self.ID_TOOL_PASTE = wx.NewId() self.ID_TOOL_LOCATE = wx.NewId() # Init HTML help wx.FileSystem.AddHandler(wx.ZipFSHandler()) self.htmlCtrl = wx.html.HtmlHelpController() programPath = os.path.dirname(sys.argv[0]) if not (self.htmlCtrl.AddBook(os.path.join(programPath, "xrced.htb"))): print >> sys.stderr, "Cannot load help file \"xrced.htb\"" self.GetMenuBar().Enable(wx.ID_HELP_CONTENTS, FALSE) # Create toolbar self.tb = tb = wx.ToolBar(self, -1, style=wx.TB_FLAT | wx.TB_NODIVIDER) # Use tango icons and slightly wider bitmap size on Mac if wx.Platform in ['__WXMAC__', '__WXMSW__']: tb.SetToolBitmapSize((26, 26)) else: tb.SetToolBitmapSize((24, 24)) self.InitToolBar(g.useAUI or g.conf.embedPanel) # add tools if g.useAUI: self.mgr = wx.aui.AuiManager() self.mgr.SetManagedWindow(self) self.mgr.AddPane( tb, wx.aui.AuiPaneInfo().Name("tb").Caption("Toolbar").ToolbarPane( ).Top().LeftDockable(False).RightDockable(False)) parent = self else: self.SetToolBar(tb) # Horizontal sizer for toolbar and splitter splitter = wx.SplitterWindow(self, -1, style=wx.SP_3DSASH) self.splitter = splitter splitter.SetMinimumPaneSize(100) parent = splitter global tree tree = XMLTree(parent) global panel if g.useAUI: self.mgr.AddPane( tree, wx.aui.AuiPaneInfo().Name("tree").Caption( "XML Tree").CenterPane()) panel = Panel(self) self.mgr.AddPane( panel, wx.aui.AuiPaneInfo().Name("panel").Caption("Attributes").Right( ).CloseButton(True).MaximizeButton(False)) self.miniFrame = None else: # Miniframe for split mode self.miniFrame = mf = wx.MiniFrame(self, -1, 'Attributes', g.conf.panelPos, g.conf.panelSize, style=wx.CAPTION | wx.RESIZE_BORDER) # This causes hiding on KDE # |wx.FRAME_TOOL_WINDOW) if wx.Platform != '__WXMAC__': mf.SetIcons(self.icns) mf.tb = mf.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT) # Use tango icons and slightly wider bitmap size on Mac if wx.Platform in ['__WXMAC__', '__WXMSW__']: mf.tb.SetToolBitmapSize((26, 26)) else: mf.tb.SetToolBitmapSize((24, 24)) self.InitMiniFrameToolBar(mf.tb) mfSizer = wx.BoxSizer() mf.SetMinSize((100, 100)) mf.SetSizer(mfSizer) if wx.Platform == '__WXMAC__': # mac don't respect pos and size exactly mf.SetPosition(g.conf.panelPos) mf.SetSize(g.conf.panelSize) # Create attribute panel if g.conf.embedPanel: panel = Panel(splitter) # Set plitter windows splitter.SplitVertically(tree, panel, g.conf.sashPos) else: panel = Panel(mf) mfSizer.Add(panel, 1, wx.EXPAND) splitter.Initialize(tree) if wx.Platform == '__WXMAC__': self.SetClientSize(size)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), style = wx.CAPTION | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CLOSE_BOX )# size=(350, 150)) try: check_protocol() r = check_client() if r is not True: dlg = wx.MessageDialog(self, 'Client outdated! New version ' + `r` + ' available! Visit EVE-Central.com to update!', 'Outdated client', wx.OK | wx.ICON_ERROR ) dlg.ShowModal() dlg.Destroy() os.system("explorer http://eve-central.com") sys.exit(-1) except IOError: dlg = wx.MessageDialog(self, 'The network appears to be down. I cannot reach EVE-central.com. Check your firewall settings or internet connection', 'Can\'t communicate with EVE-Central.com', wx.OK | wx.ICON_ERROR ) dlg.ShowModal() dlg.Destroy() sys.exit(-1) # Load config config = Config() r = config.reinit if r == -1: dlg = wx.MessageDialog(self, """The uploader client configuration has been reset since an old configuration file was found. Please check your configuration (such as path).""", 'Client Upgrade', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() self.scanner_thread = ScannerThread() self.scanner_thread.start() def donecb(count, success, this=self): evt = DoneUploadEvent(count = count, success = success) wx.PostEvent(this, evt) self.donecb = donecb def updcb(typename, success, this=self): #print "UPD: %s, %s" % (typename, success,) evt = UpdateUploadEvent(typename = typename, success = success) wx.PostEvent(this, evt) self.updcb = updcb self.uploader = get_uploader(config, updcb) # Set icon self.SetIcon(images.getIconIcon()) # Task Bar self.tbicon = TaskBarIcon(self) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # option menu opmenu = wx.Menu() # help menu helpmenu = wx.Menu() # add an item to the menu, using \tKeyName automatically # creates an accelerator, the third param is some help text # that will show up in the statusbar menu.Append(self.MENU_SCANNOW, "S&can now...") menu.AppendSeparator() #menu.Append(self.MENU_SETTINGS, "&Settings...") #menu.Append(self.MENU_LOCATE, "&Locate cache folder...") menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit") helpmenu.Append(self.MENU_ABOUT, "&About") # bind the menu event to an event handler self.Bind(wx.EVT_MENU, self.OnTimer, id=self.MENU_SCANNOW) self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.OnAbout, id = self.MENU_ABOUT) self.Bind(wx.EVT_CLOSE, self.OnTimeToClose) # and put the menu on the menubar menuBar.Append(menu, "&File") menuBar.Append(helpmenu, "&Help") self.SetMenuBar(menuBar) self.CreateStatusBar() self.SetStatusText("Idle") # Now create the Panel to put the other controls on. panel = wx.Panel(self) self.pathtext = wx.StaticText(panel, -1, "Please wait...") self.pathtext_l = wx.StaticText(panel, -1, "Using folder: Autodetecting folders.") #self.usertext_l = wx.StaticText(panel, -1, "Character name: ") #self.usertext = wx.StaticText(panel, -1, "...") self.uploadtext = wx.StaticText(panel, -1, "") if config['character_id'] == 0: self.uploads = long(0) else: self.uploads = long(0) self.scans = 0 self.motd = wx.TextCtrl(panel, -1, "", size=(200, 100), style=wx.TE_MULTILINE|wx.TE_READONLY) self.update_motd() #text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) sizer = wx.BoxSizer(wx.VERTICAL) sizer_path = wx.FlexGridSizer(2,2) #-- sizer_path.Add(self.pathtext_l, 2, wx.EXPAND|wx.ALL, 1) sizer_path.Add(self.pathtext, 0, wx.ALL|wx.EXPAND, 1) #sizer_path.Add(self.usertext_l, 2, wx.EXPAND|wx.ALL, 1) #sizer_path.Add(self.usertext, 0, wx.ALL|wx.EXPAND, 1) #-- sizer.Add(sizer_path, 0, wx.EXPAND | wx.ALL, 1) line = wx.StaticLine(panel, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) sizer.Add(self.uploadtext, 0, wx.ALL, 1) sizer.Add(self.motd, 4, wx.ALL|wx.EXPAND, 1) panel.SetSizer(sizer) panel.Layout() self.timer = wx.Timer(self) self.timer.Start(120000) self.Bind(wx.EVT_TIMER, self.OnTimer) self.Bind(EVT_UPDATE_UPLOAD, self.OnUploadUpdate) self.Bind(EVT_DONE_UPLOAD, self.OnUploadDone) self.load_infowidgets() self.paths = [] self.paths_age = time.time()
def __init__(self, pos, size): wx.Frame.__init__(self, None, -1, "XRCed", pos, size) bar = self.CreateStatusBar(2) bar.SetStatusWidths([-1, 40]) if wx.Platform != "__WXMAC__": self.icns = wx.IconBundleFromIcon(images.getIconIcon()) self.SetIcons(self.icns) self.InitMenuBar() self.ID_TOOL_PASTE = wx.NewId() self.ID_TOOL_LOCATE = wx.NewId() # Init HTML help wx.FileSystem.AddHandler(wx.ZipFSHandler()) self.htmlCtrl = wx.html.HtmlHelpController() programPath = os.path.dirname(__file__) if not (self.htmlCtrl.AddBook(os.path.join(programPath, "xrced.htb"))): print >>sys.stderr, 'Cannot load help file "xrced.htb"' self.GetMenuBar().Enable(wx.ID_HELP_CONTENTS, False) # Create toolbar self.tb = tb = wx.ToolBar(self, -1, style=wx.TB_FLAT | wx.TB_NODIVIDER) # Use tango icons and slightly wider bitmap size on Mac if wx.Platform == "__WXMAC__": tb.SetToolBitmapSize((32, 32)) # if wx.Platform == '__WXMSW__': # tb.SetToolBitmapSize((26,26)) # elif wx.Platform == '__WXGTK__': # tb.SetToolBitmapSize((24,24)) self.InitToolBar(g.useAUI or g.conf.embedPanel) # add tools if g.useAUI: self.mgr = wx.aui.AuiManager() self.mgr.SetManagedWindow(self) parent = self else: splitter = wx.SplitterWindow(self, -1, style=wx.SP_3DSASH) self.splitter = splitter splitter.SetMinimumPaneSize(100) parent = splitter # always use the native toolbar on Mac, it looks too sucky otherwise if g.useAUI and wx.Platform != "__WXMAC__": self.mgr.AddPane( tb, wx.aui.AuiPaneInfo() .Name("tb") .Caption("Toolbar") .ToolbarPane() .Top() .LeftDockable(False) .RightDockable(False), ) else: self.SetToolBar(tb) global tree tree = XMLTree(parent) global panel if g.useAUI: self.mgr.AddPane(tree, wx.aui.AuiPaneInfo().Name("tree").Caption("XML Tree").CenterPane()) panel = Panel(self) self.mgr.AddPane( panel, wx.aui.AuiPaneInfo() .Name("attrpanel") .Caption("Attributes") .MinSize(panel.GetBestSize()) .Right() .CloseButton(True) .MaximizeButton(False), ) self.miniFrame = None else: # Miniframe for split mode self.miniFrame = mf = wx.MiniFrame( self, -1, "Attributes", g.conf.panelPos, g.conf.panelSize, style=wx.CAPTION | wx.RESIZE_BORDER ) # This causes hiding on KDE # |wx.FRAME_TOOL_WINDOW) if wx.Platform != "__WXMAC__": mf.SetIcons(self.icns) mf.tb = mf.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT) # Use tango icons and slightly wider bitmap size on Mac if wx.Platform == "__WXMAC__": mf.tb.SetToolBitmapSize((32, 32)) # if wx.Platform == '__WXMSW__': # mf.tb.SetToolBitmapSize((26,26)) # elif wx.Platform == '__WXGTK__': # mf.tb.SetToolBitmapSize((24,24)) self.InitMiniFrameToolBar(mf.tb) mfSizer = wx.BoxSizer() mf.SetMinSize((100, 100)) mf.SetSizer(mfSizer) if wx.Platform == "__WXMAC__": # mac don't respect pos and size exactly mf.SetPosition(g.conf.panelPos) mf.SetSize(g.conf.panelSize) # Create attribute panel if g.conf.embedPanel: panel = Panel(splitter) # Set plitter windows splitter.SplitVertically(tree, panel, g.conf.sashPos) else: panel = Panel(mf) mfSizer.Add(panel, 1, wx.EXPAND) splitter.Initialize(tree) if wx.Platform == "__WXMAC__": self.SetClientSize(size)
def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), style=wx.CAPTION | wx.MINIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CLOSE_BOX) # size=(350, 150)) try: check_protocol() r = check_client() if r is not True: dlg = wx.MessageDialog( self, 'Client outdated! New version ' + ` r ` + ' available! Visit EVE-Central.com to update!', 'Outdated client', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() os.system("explorer http://eve-central.com") sys.exit(-1) except IOError: dlg = wx.MessageDialog( self, 'The network appears to be down. I cannot reach EVE-central.com. Check your firewall settings or internet connection', 'Can\'t communicate with EVE-Central.com', wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() sys.exit(-1) # Load config config = Config() r = config.reinit if r == -1: dlg = wx.MessageDialog( self, """The uploader client configuration has been reset since an old configuration file was found. Please check your configuration (such as path).""", 'Client Upgrade', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() self.scanner_thread = ScannerThread() self.scanner_thread.start() def donecb(count, success, this=self): evt = DoneUploadEvent(count=count, success=success) wx.PostEvent(this, evt) self.donecb = donecb def updcb(typename, success, this=self): #print "UPD: %s, %s" % (typename, success,) evt = UpdateUploadEvent(typename=typename, success=success) wx.PostEvent(this, evt) self.updcb = updcb self.uploader = get_uploader(config, updcb) # Set icon self.SetIcon(images.getIconIcon()) # Task Bar self.tbicon = TaskBarIcon(self) # Create the menubar menuBar = wx.MenuBar() # and a menu menu = wx.Menu() # option menu opmenu = wx.Menu() # help menu helpmenu = wx.Menu() # add an item to the menu, using \tKeyName automatically # creates an accelerator, the third param is some help text # that will show up in the statusbar menu.Append(self.MENU_SCANNOW, "S&can now...") menu.AppendSeparator() #menu.Append(self.MENU_SETTINGS, "&Settings...") #menu.Append(self.MENU_LOCATE, "&Locate cache folder...") menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit") helpmenu.Append(self.MENU_ABOUT, "&About") # bind the menu event to an event handler self.Bind(wx.EVT_MENU, self.OnTimer, id=self.MENU_SCANNOW) self.Bind(wx.EVT_MENU, self.OnTimeToClose, id=wx.ID_EXIT) self.Bind(wx.EVT_MENU, self.OnAbout, id=self.MENU_ABOUT) self.Bind(wx.EVT_CLOSE, self.OnTimeToClose) # and put the menu on the menubar menuBar.Append(menu, "&File") menuBar.Append(helpmenu, "&Help") self.SetMenuBar(menuBar) self.CreateStatusBar() self.SetStatusText("Idle") # Now create the Panel to put the other controls on. panel = wx.Panel(self) self.pathtext = wx.StaticText(panel, -1, "Please wait...") self.pathtext_l = wx.StaticText( panel, -1, "Using folder: Autodetecting folders.") #self.usertext_l = wx.StaticText(panel, -1, "Character name: ") #self.usertext = wx.StaticText(panel, -1, "...") self.uploadtext = wx.StaticText(panel, -1, "") if config['character_id'] == 0: self.uploads = long(0) else: self.uploads = long(0) self.scans = 0 self.motd = wx.TextCtrl(panel, -1, "", size=(200, 100), style=wx.TE_MULTILINE | wx.TE_READONLY) self.update_motd() #text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD)) sizer = wx.BoxSizer(wx.VERTICAL) sizer_path = wx.FlexGridSizer(2, 2) #-- sizer_path.Add(self.pathtext_l, 2, wx.EXPAND | wx.ALL, 1) sizer_path.Add(self.pathtext, 0, wx.ALL | wx.EXPAND, 1) #sizer_path.Add(self.usertext_l, 2, wx.EXPAND|wx.ALL, 1) #sizer_path.Add(self.usertext, 0, wx.ALL|wx.EXPAND, 1) #-- sizer.Add(sizer_path, 0, wx.EXPAND | wx.ALL, 1) line = wx.StaticLine(panel, -1, size=(20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5) sizer.Add(self.uploadtext, 0, wx.ALL, 1) sizer.Add(self.motd, 4, wx.ALL | wx.EXPAND, 1) panel.SetSizer(sizer) panel.Layout() self.timer = wx.Timer(self) self.timer.Start(120000) self.Bind(wx.EVT_TIMER, self.OnTimer) self.Bind(EVT_UPDATE_UPLOAD, self.OnUploadUpdate) self.Bind(EVT_DONE_UPLOAD, self.OnUploadDone) self.load_infowidgets() self.paths = [] self.paths_age = time.time()