def main(): markets = stockmarket.main() aggr = aggregator.main(markets) viewer.main(aggr) print("\nPress enter to quit.\n") input()
if 0: import reloader helper = reloader.ReloaderWindow() if 1: import viewer viewer.main() if 0: import ubreedr ubreedr.main() if 0: import gardener gardener.main()
# Copyright 2010 senicar # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys import os try: import pygtk pygtk.require("2.0") import gtk import gtk.glade except: print "You need to install pyGTK or GTKv2", sys.exit(1) if __name__ == "__main__": from viewer.main import * sys.path.insert(0, os.getcwd()) main(sys.argv)
def __init__(self): app.data_location='/home/'+getpass.getuser()+'/.expensemanager/data/' dest_dir = os.path.join(app.data_location[0:-5],'data/') try: f=open(app.data_location+'years','r') f.readlines() f.close() except : #script_dir = os.path.dirname(os.path.abspath(__file__)) #dest_dir = os.path.join(app.data_location) #print type(dest_dir), dest_dir #print 1 try: #print 2 os.makedirs(dest_dir) except OSError: pass self.window=gtk.Window() self.window.set_default_size(1220,658) self.window.set_position(gtk.WIN_POS_CENTER) self.window.connect("delete_event",self.terminate) self.window.set_title("Expense Manager") vbox = gtk.VBox(False) hbox = gtk.HBox() settings=(gtk.Button()).get_settings() settings.set_property("gtk-button-images",True) button1 = gtk.Button(stock=gtk.STOCK_EDIT) button1.connect('clicked',self.edit) button2 = gtk.Button(stock=gtk.STOCK_ADD) button2.connect('clicked',self.gocl) #liststore for months liststore = gtk.ListStore(str) self.months=["JAN",'FEB','MAR','APR','MAY','JUNE','JULY','AUG','SEPT','OCT','NOV','DEC'] for i in self.months: liststore.append([i]) cell = gtk.CellRendererText() self.combobox = gtk.ComboBox(liststore) self.combobox.pack_start(cell, True) self.combobox.add_attribute(cell, "text", 0) self.combobox.connect('changed',self.changed_item) now=datetime.datetime.now() self.mm=now.month-1 self.dd=now.day self.yy=now.year #self.yy='2012' self.combobox.set_active(self.mm) a= self.combobox.get_active_text() #dest_dir = os.path.join(/home/+get,getpass.getuser() 'data') self.fname=app.data_location+str(self.yy)+'_'+a try: f=open(app.data_location+'years','r') f.close() except : f=open(app.data_location+'years','w') f.write(str(self.yy)+'\n') f.close() #hbox.add(button1) hbox.pack_start(button2,False) hbox.pack_start(button1,False) #hbox.add(button4) self.select_years() hbox.pack_end(self.combobox2,False) hbox.pack_end(self.combobox,False) button5=gtk.Button(stock=gtk.STOCK_ABOUT) button5.connect('clicked',self.about) #hbox.pack_end(buttmon5,False) vbox.pack_start(hbox, False) #hbox contains the add/stats/edit etc buttons/comboboxes hbox2=gtk.HBox() hbox2.pack_end(button5,False) #button5 is the about button label_user=gtk.Label(' Welcome, '+getpass.getuser().title()+'.') hbox2.pack_start(label_user,False) vbox.pack_end(hbox2,False) #hbox2 holds only the about button sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) store = self.create_model() self.treeView = gtk.TreeView(store) #tvc=gtk.TreeViewColumn() self.treeView.set_rules_hint(True) self.treeView.connect('cursor-changed',self.on_activated) sw.add(self.treeView) pane=gtk.HPaned() pane.pack1(sw)#,resize=True, shrink=True) #self.sw_graphs=gtk.ScrolledWindow() #self.sw_graphs.set_shadow_type(gtk.SHADOW_ETCHED_IN) #self.sw_graphs.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.f = plt.figure(dpi=75,facecolor='w') #self.f.patch.set_alpha(0.95) self.f.subplots_adjust(left = 0.08,bottom=0.1,top = 0.9,right=0.95,wspace=0.25,hspace=0.25) self.canvas = FigureCanvas(self.f) self.line1=[] self.line1b=[] self.line2=[] self.graphs(1) self.graphs(2) #self.sw_graphs.add_with_viewport(self.canvas) frame=gtk.Frame() frame.add(self.canvas) pane_rightPane=gtk.VPaned() pane_stats_viewer=gtk.HPaned() viewer_sw = gtk.ScrolledWindow() viewer_sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) viewer_sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) viewer_sw.add(viewer.treeView) x=app.data_location+str(self.yy)+'_'+ str(self.months[self.mm])+' '+str(self.dd) #print x viewer.update(self,x) viewer.main(self) stats_sw = gtk.ScrolledWindow() stats_sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) stats_sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) stats.main(self,self.fname) stats_sw.add(stats.treeView) pane_stats_viewer.add1(stats_sw) pane_stats_viewer.set_position(182) pane_stats_viewer.add2(viewer_sw) pane_rightPane.add1(frame) pane_rightPane.set_position(390) pane_rightPane.add2(pane_stats_viewer) pane.pack2(pane_rightPane,resize=True, shrink=False) pane.set_position(590) #pane.compute_position(1120, True, False) #pane.queue_resize() vbox.pack_start(pane) self.create_columns(self.treeView) self.window.add(vbox) self.window.show_all()