def __init__(self, size=(36, 24), text=wx.EmptyString, img=None, inclination=6, closeButton=True): """ Renders a new tab text -- tab label img -- wxImage of tab icon inclination -- does not seem to affect class, maybe used to be a variable for custom drawn tab inclinations before there were bitmaps? closeButton -- True if tab can be closed """ # tab left/right zones inclination self.ctabLeft = BitmapLoader.getImage("ctableft", "gui") self.ctabMiddle = BitmapLoader.getImage("ctabmiddle", "gui") self.ctabRight = BitmapLoader.getImage("ctabright", "gui") self.ctabClose = BitmapLoader.getImage("ctabclose", "gui") self.leftWidth = self.ctabLeft.GetWidth() self.rightWidth = self.ctabRight.GetWidth() self.middleWidth = self.ctabMiddle.GetWidth() self.closeBtnWidth = self.ctabClose.GetWidth() width, height = size if width < self.leftWidth + self.rightWidth + self.middleWidth: width = self.leftWidth + self.rightWidth + self.middleWidth if height < self.ctabMiddle.GetHeight(): height = self.ctabMiddle.GetHeight() self.inclination = inclination self.text = text self.disabled = False self.tabSize = (width, height) self.closeButton = closeButton self.selected = False self.closeBtnHovering = False self.tabBitmap = None self.tabBackBitmap = None self.cbSize = 5 self.padding = 4 self.font = wx.Font(fonts.NORMAL, wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.tabImg = img self.position = ( 0, 0 ) # Not used internally for rendering - helper for tab container self.InitTab()
def __init__(self, parent, size=(0, 0)): wx.gizmos.TreeListCtrl.__init__(self, parent, size=size) self.tabManager = parent self.fleetId = None self.fleetImg = BitmapLoader.getImage("53_16", "icons") self.imageList = wx.ImageList(16, 16) self.SetImageList(self.imageList) for col in ("", "Fit", "Shiptype", "Character", "Bonusses"): self.AddColumn(col) self.SetMainColumn(1) self.icons = {} self.addImage = self.imageList.Add( BitmapLoader.getBitmap("add_small", "gui")) for icon in ("fb", "fc", "sb", "sc", "wb", "wc"): self.icons[icon] = self.imageList.Add( BitmapLoader.getBitmap("fleet_%s_small" % icon, "gui")) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.checkNew) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_RENAMED, self.fleetRenamed) self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_REMOVED, self.fleetRemoved)
def __init__(self, parent, size = (0,0)): wx.gizmos.TreeListCtrl.__init__(self, parent, size = size) self.tabManager = parent self.fleetId = None self.fleetImg = BitmapLoader.getImage("53_16", "icons") self.imageList = wx.ImageList(16, 16) self.SetImageList(self.imageList) for col in ("", "Fit", "Shiptype", "Character", "Bonusses"): self.AddColumn(col) self.SetMainColumn(1) self.icons = {} self.addImage = self.imageList.Add(BitmapLoader.getBitmap("add_small", "gui")) for icon in ("fb", "fc", "sb", "sc", "wb", "wc"): self.icons[icon] = self.imageList.Add(BitmapLoader.getBitmap("fleet_%s_small" % icon, "gui")) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.checkNew) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_RENAMED, self.fleetRenamed) self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_REMOVED, self.fleetRemoved)
def updateTab(self): sFit = Fit.getInstance() fit = sFit.getFit(self.getActiveFit(), basic=True) bitmap = BitmapLoader.getImage("race_%s_small" % fit.ship.item.race, "gui") text = "%s: %s" % (fit.ship.item.name, fit.name) pageIndex = self.parent.GetPageIndex(self) if pageIndex is not None: self.parent.SetPageTextIcon(pageIndex, text, bitmap)
def __init__(self, size=(36, 24), text=wx.EmptyString, img=None, inclination=6 , closeButton=True): """ Renders a new tab text -- tab label img -- wxImage of tab icon inclination -- does not seem to affect class, maybe used to be a variable for custom drawn tab inclinations before there were bitmaps? closeButton -- True if tab can be closed """ # tab left/right zones inclination self.ctabLeft = BitmapLoader.getImage("ctableft", "gui") self.ctabMiddle = BitmapLoader.getImage("ctabmiddle", "gui") self.ctabRight = BitmapLoader.getImage("ctabright", "gui") self.ctabClose = BitmapLoader.getImage("ctabclose", "gui") self.leftWidth = self.ctabLeft.GetWidth() self.rightWidth = self.ctabRight.GetWidth() self.middleWidth = self.ctabMiddle.GetWidth() self.closeBtnWidth = self.ctabClose.GetWidth() width, height = size if width < self.leftWidth + self.rightWidth + self.middleWidth: width = self.leftWidth + self.rightWidth + self.middleWidth if height < self.ctabMiddle.GetHeight(): height = self.ctabMiddle.GetHeight() self.inclination = inclination self.text = text self.disabled = False self.tabSize = (width, height) self.closeButton = closeButton self.selected = False self.closeBtnHovering = False self.tabBitmap = None self.tabBackBitmap = None self.cbSize = 5 self.padding = 4 self.font = wx.Font(fonts.NORMAL, wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.tabImg = img self.position = (0, 0) # Not used internally for rendering - helper for tab container self.InitTab()
def updateTab(self): sFit = service.Fit.getInstance() fit = sFit.getFit(self.getActiveFit(), basic=True) bitmap = BitmapLoader.getImage("race_%s_small" % fit.ship.item.race, "gui") text = "%s: %s" % (fit.ship.item.name, fit.name) pageIndex = self.parent.GetPageIndex(self) if pageIndex is not None: self.parent.SetPageTextIcon(pageIndex, text, bitmap)
def __init__(self, parent): TogglePanel.__init__(self, parent, forceLayout=1) self.SetLabel("Additions") pane = self.GetContentPane() baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.notebook = gui.chromeTabs.PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) droneImg = BitmapLoader.getImage("drone_small", "gui") fighterImg = BitmapLoader.getImage("fighter_small", "gui") implantImg = BitmapLoader.getImage("implant_small", "gui") boosterImg = BitmapLoader.getImage("booster_small", "gui") projectedImg = BitmapLoader.getImage("projected_small", "gui") gangImg = BitmapLoader.getImage("fleet_fc_small", "gui") cargoImg = BitmapLoader.getImage("cargo_small", "gui") self.notebook.AddPage(DroneView(self.notebook), "Drones", tabImage=droneImg, showClose=False) self.notebook.AddPage(FighterView(self.notebook), "Fighters", tabImage=fighterImg, showClose=False) self.notebook.AddPage(CargoView(self.notebook), "Cargo", tabImage=cargoImg, showClose=False) self.notebook.AddPage(ImplantView(self.notebook), "Implants", tabImage=implantImg, showClose=False) self.notebook.AddPage(BoosterView(self.notebook), "Boosters", tabImage=boosterImg, showClose=False) self.projectedPage = ProjectedView(self.notebook) self.notebook.AddPage(self.projectedPage, "Projected", tabImage=projectedImg, showClose=False) self.gangPage = GangView(self.notebook) self.notebook.AddPage(self.gangPage, "Fleet", tabImage=gangImg, showClose=False) self.notebook.SetSelection(0)
def __init__(self, parent): TogglePanel.__init__(self, parent, forceLayout=1) self.SetLabel("Additions") pane = self.GetContentPane() baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.notebook = gui.chromeTabs.PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) droneImg = BitmapLoader.getImage("drone_small", "gui") implantImg = BitmapLoader.getImage("implant_small", "gui") boosterImg = BitmapLoader.getImage("booster_small", "gui") projectedImg = BitmapLoader.getImage("projected_small", "gui") gangImg = BitmapLoader.getImage("fleet_fc_small", "gui") cargoImg = BitmapLoader.getImage("cargo_small", "gui") self.notebook.AddPage(DroneView(self.notebook), "Drones", tabImage=droneImg, showClose=False) self.notebook.AddPage(CargoView(self.notebook), "Cargo", tabImage=cargoImg, showClose=False) self.notebook.AddPage(ImplantView(self.notebook), "Implants", tabImage=implantImg, showClose=False) self.notebook.AddPage(BoosterView(self.notebook), "Boosters", tabImage=boosterImg, showClose=False) self.projectedPage = ProjectedView(self.notebook) self.notebook.AddPage(self.projectedPage, "Projected", tabImage=projectedImg, showClose=False) self.gangPage = GangView(self.notebook) self.notebook.AddPage(self.gangPage, "Fleet", tabImage=gangImg, showClose=False) self.notebook.SetSelection(0)
def __init__(self, parent): TogglePanel.__init__(self, parent, forceLayout=1) self.SetLabel("Additions") pane = self.GetContentPane() baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) self.notebook = PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) droneImg = BitmapLoader.getImage("drone_small", "gui") fighterImg = BitmapLoader.getImage("fighter_small", "gui") implantImg = BitmapLoader.getImage("implant_small", "gui") boosterImg = BitmapLoader.getImage("booster_small", "gui") projectedImg = BitmapLoader.getImage("projected_small", "gui") gangImg = BitmapLoader.getImage("fleet_fc_small", "gui") cargoImg = BitmapLoader.getImage("cargo_small", "gui") notesImg = BitmapLoader.getImage("skill_small", "gui") self.drone = DroneView(self.notebook) self.notebook.AddPage(self.drone, "Drones", tabImage=droneImg, showClose=False) self.fighter = FighterView(self.notebook) self.notebook.AddPage(self.fighter, "Fighters", tabImage=fighterImg, showClose=False) self.cargo = CargoView(self.notebook) self.notebook.AddPage(self.cargo, "Cargo", tabImage=cargoImg, showClose=False) self.implant = ImplantView(self.notebook) self.notebook.AddPage(self.implant, "Implants", tabImage=implantImg, showClose=False) self.booster = BoosterView(self.notebook) self.notebook.AddPage(self.booster, "Boosters", tabImage=boosterImg, showClose=False) self.projectedPage = ProjectedView(self.notebook) self.notebook.AddPage(self.projectedPage, "Projected", tabImage=projectedImg, showClose=False) self.gangPage = CommandView(self.notebook) self.notebook.AddPage(self.gangPage, "Command", tabImage=gangImg, showClose=False) self.notes = NotesView(self.notebook) self.notebook.AddPage(self.notes, "Notes", tabImage=notesImg, showClose=False) self.notebook.SetSelection(0)
def __init__(self): """Renders the add tab button""" self.addImg = BitmapLoader.getImage("ctabadd", "gui") self.width = self.addImg.GetWidth() self.height = self.addImg.GetHeight() self.region = None self.tbmp = wx.BitmapFromImage(self.addImg) self.addBitmap = None self.position = (0, 0) self.highlighted = False self.InitRenderer()
def __init__(self): self.title="pyfa %s%s - Python Fitting Assistant"%(config.version, "" if config.tag.lower() != 'git' else " (git)") wx.Frame.__init__(self, None, wx.ID_ANY, self.title) MainFrame.__instance = self #Load stored settings (width/height/maximized..) self.LoadMainFrameAttribs() #Fix for msw (have the frame background color match panel color if 'wxMSW' in wx.PlatformInfo: self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) #Load and set the icon for pyfa main window i = wx.IconFromBitmap(BitmapLoader.getBitmap("pyfa", "gui")) self.SetIcon(i) #Create the layout and windows mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.browser_fitting_split = wx.SplitterWindow(self, style = wx.SP_LIVE_UPDATE) self.fitting_additions_split = wx.SplitterWindow(self.browser_fitting_split, style = wx.SP_LIVE_UPDATE) mainSizer.Add(self.browser_fitting_split, 1, wx.EXPAND | wx.LEFT, 2) self.fitMultiSwitch = MultiSwitch(self.fitting_additions_split) self.additionsPane = AdditionsPane(self.fitting_additions_split) self.notebookBrowsers = gui.chromeTabs.PFNotebook(self.browser_fitting_split, False) marketImg = BitmapLoader.getImage("market_small", "gui") shipBrowserImg = BitmapLoader.getImage("ship_small", "gui") self.marketBrowser = MarketBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.marketBrowser, "Market", tabImage = marketImg, showClose = False) self.marketBrowser.splitter.SetSashPosition(self.marketHeight) self.shipBrowser = ShipBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.shipBrowser, "Ships", tabImage = shipBrowserImg, showClose = False) #======================================================================= # DISABLED FOR RC2 RELEASE #self.fleetBrowser = FleetBrowser(self.notebookBrowsers) #self.notebookBrowsers.AddPage(self.fleetBrowser, "Fleets", showClose = False) #======================================================================= self.notebookBrowsers.SetSelection(1) self.browser_fitting_split.SplitVertically(self.notebookBrowsers, self.fitting_additions_split) self.browser_fitting_split.SetMinimumPaneSize(204) self.browser_fitting_split.SetSashPosition(self.browserWidth) self.fitting_additions_split.SplitHorizontally(self.fitMultiSwitch, self.additionsPane, -200) self.fitting_additions_split.SetMinimumPaneSize(200) self.fitting_additions_split.SetSashPosition(self.fittingHeight) self.fitting_additions_split.SetSashGravity(1.0) cstatsSizer = wx.BoxSizer(wx.VERTICAL) self.charSelection = CharacterSelection(self) cstatsSizer.Add(self.charSelection, 0, wx.EXPAND) self.statsPane = StatsPane(self) cstatsSizer.Add(self.statsPane, 0, wx.EXPAND) mainSizer.Add(cstatsSizer, 0, wx.EXPAND) self.SetSizer(mainSizer) #Add menu self.addPageId = wx.NewId() self.closePageId = wx.NewId() self.widgetInspectMenuID = wx.NewId() self.SetMenuBar(MainMenuBar()) self.registerMenu() #Internal vars to keep track of other windows (graphing/stats) self.graphFrame = None self.statsWnds = [] self.activeStatsWnd = None self.Bind(wx.EVT_CLOSE, self.OnClose) #Show ourselves self.Show() self.LoadPreviousOpenFits() #Check for updates self.sUpdate = service.Update.getInstance() self.sUpdate.CheckUpdate(self.ShowUpdateBox) if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3,0)): self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin) self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout) self.titleTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updateTitle, self.titleTimer)
def __init__(self, title="pyfa"): pyfalog.debug("Initialize MainFrame") self.title = title wx.Frame.__init__(self, None, wx.ID_ANY, self.title) MainFrame.__instance = self # Load stored settings (width/height/maximized..) self.LoadMainFrameAttribs() self.disableOverrideEditor = disableOverrideEditor # Fix for msw (have the frame background color match panel color if 'wxMSW' in wx.PlatformInfo: self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) # Load and set the icon for pyfa main window i = wx.IconFromBitmap(BitmapLoader.getBitmap("pyfa", "gui")) self.SetIcon(i) # Create the layout and windows mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.browser_fitting_split = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) self.fitting_additions_split = wx.SplitterWindow( self.browser_fitting_split, style=wx.SP_LIVE_UPDATE) mainSizer.Add(self.browser_fitting_split, 1, wx.EXPAND | wx.LEFT, 2) self.fitMultiSwitch = MultiSwitch(self.fitting_additions_split) self.additionsPane = AdditionsPane(self.fitting_additions_split) self.notebookBrowsers = PFNotebook(self.browser_fitting_split, False) marketImg = BitmapLoader.getImage("market_small", "gui") shipBrowserImg = BitmapLoader.getImage("ship_small", "gui") self.marketBrowser = MarketBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.marketBrowser, "Market", tabImage=marketImg, showClose=False) self.marketBrowser.splitter.SetSashPosition(self.marketHeight) self.shipBrowser = ShipBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.shipBrowser, "Fittings", tabImage=shipBrowserImg, showClose=False) self.notebookBrowsers.SetSelection(1) self.browser_fitting_split.SplitVertically( self.notebookBrowsers, self.fitting_additions_split) self.browser_fitting_split.SetMinimumPaneSize(204) self.browser_fitting_split.SetSashPosition(self.browserWidth) self.fitting_additions_split.SplitHorizontally(self.fitMultiSwitch, self.additionsPane, -200) self.fitting_additions_split.SetMinimumPaneSize(200) self.fitting_additions_split.SetSashPosition(self.fittingHeight) self.fitting_additions_split.SetSashGravity(1.0) cstatsSizer = wx.BoxSizer(wx.VERTICAL) self.charSelection = CharacterSelection(self) cstatsSizer.Add(self.charSelection, 0, wx.EXPAND) self.statsPane = StatsPane(self) cstatsSizer.Add(self.statsPane, 0, wx.EXPAND) mainSizer.Add(cstatsSizer, 0, wx.EXPAND) self.SetSizer(mainSizer) # Add menu self.addPageId = wx.NewId() self.closePageId = wx.NewId() self.widgetInspectMenuID = wx.NewId() self.SetMenuBar(MainMenuBar(self)) self.registerMenu() # Internal vars to keep track of other windows (graphing/stats) self.graphFrame = None self.statsWnds = [] self.activeStatsWnd = None self.Bind(wx.EVT_CLOSE, self.OnClose) # Show ourselves self.Show() self.LoadPreviousOpenFits() # Check for updates self.sUpdate = Update.getInstance() self.sUpdate.CheckUpdate(self.ShowUpdateBox) if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin) self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout) self.titleTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updateTitle, self.titleTimer)
def __init__(self, parent, size=(-1, 24)): SFItem.SFBrowserItem.__init__(self, parent, size=size) self.rewBmpH = BitmapLoader.getBitmap("frewind_small", "gui") self.forwBmp = BitmapLoader.getBitmap("fforward_small", "gui") self.searchBmpH = BitmapLoader.getBitmap("fsearch_small", "gui") self.newBmpH = BitmapLoader.getBitmap("fit_add_small", "gui") self.resetBmpH = BitmapLoader.getBitmap("freset_small", "gui") self.switchBmpH = BitmapLoader.getBitmap("fit_switch_view_mode_small", "gui") self.recentBmpH = BitmapLoader.getBitmap("frecent_small", "gui") switchImg = BitmapLoader.getImage("fit_switch_view_mode_small", "gui") switchImg = switchImg.AdjustChannels(1, 1, 1, 0.4) self.switchBmpD = wx.BitmapFromImage(switchImg) recentImg = BitmapLoader.getImage("frecent_small", "gui") recentImg = recentImg.AdjustChannels(1, 1, 1, 0.4) self.recentBmpD = wx.BitmapFromImage(recentImg) self.resetBmp = self.AdjustChannels(self.resetBmpH) self.rewBmp = self.AdjustChannels(self.rewBmpH) self.searchBmp = self.AdjustChannels(self.searchBmpH) self.switchBmp = self.AdjustChannels(self.switchBmpH) self.recentBmp = self.AdjustChannels(self.recentBmpH) self.newBmp = self.AdjustChannels(self.newBmpH) self.toolbar.AddButton(self.resetBmp, "Ship groups", clickCallback=self.OnHistoryReset, hoverBitmap=self.resetBmpH) self.toolbar.AddButton(self.rewBmp, "Back", clickCallback=self.OnHistoryBack, hoverBitmap=self.rewBmpH) self.btnNew = self.toolbar.AddButton(self.newBmp, "New fitting", clickCallback=self.OnNewFitting, hoverBitmap=self.newBmpH, show=False) self.btnSwitch = self.toolbar.AddButton(self.switchBmpD, "Hide empty ship groups", clickCallback=self.ToggleEmptyGroupsView, hoverBitmap=self.switchBmpH, show=False) self.btnRecent = self.toolbar.AddButton(self.recentBmpD, "Recent Fits", clickCallback=self.ToggleRecentShips, hoverBitmap=self.recentBmpH, show=True) modifier = "CTRL" if 'wxMac' not in wx.PlatformInfo else "CMD" self.toolbar.AddButton(self.searchBmp, "Search fittings ({}+F)".format(modifier), clickCallback=self.ToggleSearchBox, hoverBitmap=self.searchBmpH) self.padding = 4 self.lastSearch = "" self.recentSearches = [] # not used? self.inSearch = False self.fontSmall = wx.Font(fonts.SMALL, wx.SWISS, wx.NORMAL, wx.NORMAL) w, h = size self.BrowserSearchBox = wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition, (-1, h - 2 if 'wxGTK' in wx.PlatformInfo else -1), (wx.BORDER_NONE if 'wxGTK' in wx.PlatformInfo else 0)) self.BrowserSearchBox.Show(False) # self.BrowserSearchBox.Bind(wx.EVT_TEXT_ENTER, self.OnBrowserSearchBoxEnter) # self.BrowserSearchBox.Bind(wx.EVT_KILL_FOCUS, self.OnBrowserSearchBoxLostFocus) self.BrowserSearchBox.Bind(wx.EVT_KEY_DOWN, self.OnBrowserSearchBoxEsc) self.BrowserSearchBox.Bind(wx.EVT_TEXT, self.OnScheduleSearch) self.SetMinSize(size) self.shipBrowser = self.Parent self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.Bind(wx.EVT_SIZE, self.OnResize)