Exemple #1
0
class PlannerFrame(wx.Frame):
      def __init__(self, parent, id=wx.ID_ANY, title="", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE, name = "PlannerFrame"):
            super(PlannerFrame, self).__init__(parent, id, title, pos, size, style, name)
            self._parent = parent
            self._title = title
            self._resources = Resources(_plannerDataDir+_ResourcesFileName)
            self._fundingSources = FundingSources(_plannerDataDir+_FundingSourcesFileName)
            self._allocations = AllocationSet(_plannerDataDir+_Allocations)

# Create MenuBar
            menuBar = wx.MenuBar()

# Create File Menu
            fileMenu = wx.Menu()
            menuExit = fileMenu.Append(wx.ID_EXIT, "E&xit"," Terminate the program")
            menuSave = fileMenu.Append(wx.ID_SAVE, "&Save", "Save Resources and Funding Sources")
            fileMenu.AppendSeparator()


# Create View Menu
            viewMenu = wx.Menu()

            PLN_RESOURCES = wx.NewId()
            PLN_FUNDINGSOURCES = wx.NewId()
            
            menuResources = viewMenu.Append(PLN_RESOURCES, "&Resources", "Bring up Resources Panel")
            menuFundingSources = viewMenu.Append(PLN_FUNDINGSOURCES, "F&unding Sources", "Bring up Funding Sources Panel")

            menuBar.Append(fileMenu, "&File")
            menuBar.Append(viewMenu, "&View")
            
            self.SetMenuBar(menuBar)
            self.CreateStatusBar()

# File Menu Items
            self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
            self.Bind(wx.EVT_MENU, self.OnSave, menuSave)

# View Menu Items            
            self.Bind(wx.EVT_MENU, self.OnResources, menuResources)
            self.Bind(wx.EVT_MENU, self.OnFundingSources, menuFundingSources)
            
            self.Show(True)

      def OnExit(self, e):
            sys.exit()

      def OnSave(self, e):
            self._resources.write()
            print "Resources Saved"
            self._fundingSources.write()
            print "Funding Sources Saved"
            
      def OnResources(self, e):
            self._resourcesWindow = SelectionListbox(self, self._resources)

      def OnFundingSources(self, e):
            self._fundingSourcesWindow = SelectionListbox(self, self._fundingSources)
Exemple #2
0
def main():
      
      app = wx.App()

      ress = Resources("/users/swiftb/dev/Planner/data/testresources.txt")
      res = Resource("{'UID': '1', 'First Name': 'Brian', 'Last Name': 'Swift', 'Location': 'CHI'}")
      ress.add(res)
      res = Resource("{'UID': '2', 'First Name': 'John', 'Last Name': 'DeValk', 'Location': 'CHI'}")
      ress.add(res)
      ress.write()
      print ress._resources
      
      mc = SelectionFrame(None, ress)
      app.MainLoop()
Exemple #3
0
def main():
      
      root = Tk()
      root.geometry("250x150+300+300")
      sl = Resources("/users/swiftb/dev/Planner/data/testresources.txt")
      res = Resource("{'UID': '1', 'First Name': 'Brian', 'Last Name': 'Swift', 'Location': 'CHI'}")
      sl.add(res)
      res = Resource("{'UID': '2', 'First Name': 'John', 'Last Name': 'DeValk', 'Location': 'CHI'}")
      sl.add(res)
      sl.write()
      print sl._resources
      
      mc = SelectionListbox(root, sl)
      root.mainloop()