Пример #1
0
 def closeClicked(self, arg=None, event=None):
     if ui.mainWin:
         self.hide()
     else:
         self.destroy()
         core.stopRunningThreads()
         gtk.main_quit()
     return True
Пример #2
0
	def closeClicked(self, arg=None, event=None):
		if ui.mainWin:
			self.hide()
		else:
			self.destroy()
			core.stopRunningThreads()
			gtk.main_quit()
		return True
Пример #3
0
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()
    ###############################
    checkEventsReadOnly(False)
    ## right place? FIXME
    if core.BRANCH == 'master' and versionLessThan(event_lib.info.version, '2.3.0'):
        from scal3.ui_gtk.event.bulk_save_timezone import BulkSaveTimeZoneDialog
        BulkSaveTimeZoneDialog(parent=None).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.new(gdk.CursorType.LEFT_PTR))#???????????
    #mainWin.app.run(None)
    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
Пример #4
0
 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 ?
     self.destroy()
     ######
     core.stopRunningThreads()
     ######
     return gtk.main_quit()
Пример #5
0
	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 ?
		self.destroy()
		######
		core.stopRunningThreads()
		######
		return gtk.main_quit()
Пример #6
0
			gtk.main_iteration_do(False)
		error = account.fetchGroups()
		if error:
			print(error)
			return # error? FIXME
		account.save()

	def okClicked(self, widget):
		error = self.waitingDo(self.doRegister)
		if not error:
			self.destroy()
		return True

	def cancelClicked(self, widget):
		self.destroy()
		return True

	def onDeleteEvent(self, obj, event):
		self.destroy()
		return True


if __name__ == "__main__":
	if locale_man.rtl:
		gtk.Widget.set_default_direction(gtk.TextDirection.RTL)
	d = StarCalendarRegisterDialog()
	d.present()
	gtk.main()
	core.stopRunningThreads()
	gtk.main_quit()
Пример #7
0

def testOverlapsSpeed():
    from random import normalvariate
    from time import time
    N = 2000000
    a0, b0 = -1, 1
    b_mean = 0
    b_sigma = 2
    ###
    getRandomPair = lambda: sorted(
        normalvariate(b_mean, b_sigma) for i in (0, 1))
    ###
    data = []
    for i in range(N):
        a, b = getRandomPair()
        data.append((a, b))
    t0 = time()
    for a, b in data:
        ab_overlaps(a0, b0, a, b)
    print("%.2f" % (time() - t0))


if __name__ == "__main__":
    import pprint
    testnormalizeIntervalList()
    testIntersection()
    testJdRanges()
    testSimplifyNumList()
    core.stopRunningThreads()