Add fleet browser, view and service (basic skeleton)

This commit is contained in:
cncfanatics
2010-11-19 14:43:01 +01:00
parent 6b3c175aab
commit 768f9c9471
5 changed files with 83 additions and 1 deletions

2
eos

Submodule eos updated: 2f9471309e...251d9b87e4

8
gui/fleetBrowser.py Executable file
View File

@@ -0,0 +1,8 @@
import wx
FleetSelected, EVT_FLEET_SELECTED = wx.lib.newevent.NewEvent()
class FleetBrowser(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
self.SetBackgroundColour("pink")

29
gui/fleetView.py Executable file
View File

@@ -0,0 +1,29 @@
import wx.gizmos
import gui.fleetBrowser
#Tab spawning handler
class FleetSpawner(gui.multiSwitch.TabSpawner):
def __init__(self, multiSwitch):
self.multiSwitch = multiSwitch
mainFrame = gui.mainFrame.MainFrame.getInstance()
mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_SELECTED, self.fleetSelected)
def fleetSelected(self, event):
view = FleetView(self.multiSwitch)
self.multiSwitch.ReplaceActivePage(view)
FleetSpawner.register()
class FleetView(wx.gizmos.TreeListCtrl):
def __init__(self, parent):
wx.gizmos.TreeListCtrl.__init__(self, parent)
self.imageList = wx.ImageList(16, 16)
self.SetImageList(self.imageList)
for col in ("Fit", "Character", "Bonusses"):
self.AddColumn(col)
self.AddRoot("WC")
def populate(self):
pass

View File

@@ -33,6 +33,7 @@ from gui.patternEditor import DmgPatternEditorDlg
from gui.preferenceDialog import PreferenceDialog
from gui.graphFrame import GraphFrame
from gui.copySelectDialog import CopySelectDialog
from gui.fleetBrowser import FleetBrowser
import aboutData
import gui.fittingView as fv
from wx._core import PyDeadObjectError
@@ -97,6 +98,10 @@ class MainFrame(wx.Frame):
self.shipBrowser = ShipBrowser(self.notebookBrowsers)
self.notebookBrowsers.AddPage(self.shipBrowser, "Ships", showClose = False)
self.fleetBrowser = FleetBrowser(self.notebookBrowsers)
self.notebookBrowsers.AddPage(self.fleetBrowser, "Fleets", showClose = False)
self.notebookBrowsers.SetSelection(1)
self.splitter.SplitVertically(self.notebookBrowsers, self.FitviewAdditionsPanel)

40
service/fleet.py Executable file
View File

@@ -0,0 +1,40 @@
#===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
#===============================================================================
import eos.db
class Fleet(object):
instance = None
@classmethod
def getInstance(cls):
if cls.instance is None:
cls.instance = Fleet()
return cls.instance
def __init__(self):
pass
def getFleetList(self):
fleetList = []
fleets = eos.db.getFleetList()
for fleet in fleets:
fleetList.append(fleet.ID, fleet.name, fleet.count())
return fleetList