コード例 #1
0
ファイル: starcal2.py プロジェクト: ilius/starcal2
def main():
    '''
	try:
		import psyco
	except ImportError:
		print('Warning: module "psyco" not found. It could speed up execution.')
		psyco_found=False
	else:
		psyco.full()
		print('Using module "psyco" to speed up execution.')
		psyco_found=True'''
    statusIconMode = 2
    action = ''
    if ui.showMain:
        action = 'show'
    if len(sys.argv) > 1:
        if sys.argv[1] in ('--no-tray-icon', '--no-status-icon'):
            statusIconMode = 0
            action = 'show'
        elif sys.argv[1] == '--hide':
            action = ''
        elif sys.argv[1] == '--show':
            action = 'show'
        #elif sys.argv[1]=='--html':#????????????
        #	action = 'html'
        #elif sys.argv[1]=='--svg':#????????????
        #	action = 'svg'
    ###############################
    ui.init()
    ###############################
    ## right place? FIXME
    if core.BRANCH == 'master' and versionLessThan(event_lib.info.version,
                                                   '2.3.0'):
        from scal2.ui_gtk.event.bulk_save_timezone import BulkSaveTimeZoneDialog
        BulkSaveTimeZoneDialog().run()
    event_lib.info.updateAndSave()
    ###############################
    mainWin = MainWin(statusIconMode=statusIconMode)
    #if action=='html':
    #	mainWin.exportHtml('calendar.html') ## exportHtml(path, months, title)
    #	sys.exit(0)
    #elif action=='svg':
    #	mainWin.export.exportSvg('%s/2010-01.svg'%core.deskDir, [(2010, 1)])
    #	sys.exit(0)
    if action == 'show' or not mainWin.sicon:
        mainWin.present()
    ##ud.rootWindow.set_cursor(gdk.Cursor(gdk.LEFT_PTR))#???????????
    ex = 0
    try:
        ex = gtk.main()
    except KeyboardInterrupt:
        print('You pressed Control+C, Goodbye')
        core.stopRunningThreads()
    except Exception as e:
        core.stopRunningThreads()
        raise e
    return ex
コード例 #2
0
ファイル: starcal2.py プロジェクト: amirkarimi/starcal
def main():
    '''
    try:
        import psyco
    except ImportError:
        print('Warning: module "psyco" not found. It could speed up execution.')
        psyco_found=False
    else:
        psyco.full()
        print('Using module "psyco" to speed up execution.')
        psyco_found=True'''
    statusIconMode = 2
    action = ''
    if ui.showMain:
        action = 'show'
    if len(sys.argv)>1:
        if sys.argv[1] in ('--no-tray-icon', '--no-status-icon'):
            statusIconMode = 0
            action = 'show'
        elif sys.argv[1]=='--hide':
            action = ''
        elif sys.argv[1]=='--show':
            action = 'show'
        #elif sys.argv[1]=='--html':#????????????
        #    action = 'html'
        #elif sys.argv[1]=='--svg':#????????????
        #    action = 'svg'
    ###############################
    ui.init()
    ###############################
    ## right place? FIXME
    if core.BRANCH == 'master' and versionLessThan(event_lib.info.version, '2.3.0'):
        from scal2.ui_gtk.event.bulk_save_timezone import BulkSaveTimeZoneDialog
        BulkSaveTimeZoneDialog().run()
    event_lib.info.updateAndSave()
    ###############################
    mainWin = MainWin(statusIconMode=statusIconMode)
    #if action=='html':
    #    mainWin.exportHtml('calendar.html') ## exportHtml(path, months, title)
    #    sys.exit(0)
    #elif action=='svg':
    #    mainWin.export.exportSvg('%s/2010-01.svg'%core.deskDir, [(2010, 1)])
    #    sys.exit(0)
    if action=='show' or not mainWin.sicon:
        mainWin.present()
    ##ud.rootWindow.set_cursor(gdk.Cursor(gdk.LEFT_PTR))#???????????
    ex = 0
    try:
        ex = gtk.main()
    except KeyboardInterrupt:
        print('You pressed Control+C, Goodbye')
        core.stopRunningThreads()
    except Exception as e:
        core.stopRunningThreads()
        raise e
    return ex
コード例 #3
0
ファイル: starcal2.py プロジェクト: amirkarimi/starcal
 def quit(self, widget=None, event=None):
     try:
         ui.saveLiveConf()
     except:
         myRaise()
     if self.statusIconMode>1 and self.sicon:
         self.sicon.set_visible(False) ## needed for windows ## before or after main_quit ?
     ######
     core.stopRunningThreads()
     ######
     return gtk.main_quit()
コード例 #4
0
ファイル: starcal2.py プロジェクト: ilius/starcal2
 def quit(self, widget=None, event=None):
     try:
         ui.saveLiveConf()
     except:
         myRaise()
     if self.statusIconMode > 1 and self.sicon:
         self.sicon.set_visible(
             False)  ## needed for windows ## before or after main_quit ?
     ######
     core.stopRunningThreads()
     ######
     return gtk.main_quit()