def run_app(args): ## GUI app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") app.setQuitOnLastWindowClosed(False) ## disable Alt key switching to application menu app.setStyle(MenuStyle()) setup_interrupt_handling() window = MainWindow() if args.blocksave is True: window.disableSaving() window.loadSettings() window.loadData() if args.minimized is False: window.show() exitCode = app.exec_() if exitCode == 0: window.saveAll() return exitCode
task2 = Task() task2.title = "Task 1" task2.description = "Description" task2.completed = 0 task2.priority = 3 task2.setDefaultDateTime( taskDate + timedelta( hours=6 ) ) task3 = Task() task3.title = "Full Day Task" task3.description = "Description" task3.completed = 0 task3.priority = 3 task3.startDateTime = taskDate - timedelta( days=2 ) task3.dueDateTime = task3.startDateTime + timedelta( days=4 ) setup_interrupt_handling() widget = DayListWidget() widget.showCompletedTasks() widget.resize( 800, 600 ) widget.setTasks( [task1, task2, task3], taskDate.date() ) widget.show() root_path = get_root_path() renderToPixmap( widget, root_path + "/tmp/daylistwidget-big.png" ) # print( "Dialog return:", dialogCode ) # print( "Created task:", dialog.task ) sys.exit( app.exec_() )
## when import fails then it means that the script was executed indirectly ## in this case __init__ is already loaded pass import sys from hanlendar.gui.qt import QApplication from hanlendar.gui.sigint import setup_interrupt_handling from hanlendar.gui.widget.noteswidget import NotesWidget # from hanlendar.domainmodel.task import Task ## ============================= main section =================================== if __name__ != '__main__': sys.exit(0) app = QApplication(sys.argv) app.setApplicationName("Hanlendar") app.setOrganizationName("arnet") ### app.setOrganizationDomain("www.my-org.com") setup_interrupt_handling() widget = NotesWidget() widget.addTab("notes2") widget.show() exitCode = app.exec_() sys.exit(exitCode)