def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = KPlato.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(i18n("Busy Information Export")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed datapage = self.dialog.addPage(i18n("Schedules"),i18n("Export Selected Schedule"),"document-export") self.scheduleview = KPlato.createScheduleListView(datapage) savepage = self.dialog.addPage(i18n("Save"),i18n("Export Busy Info File"),"document-save") self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kplatobusyinfoexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1' : i18n("Resource Busy Information"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doExport( self.proj ) except Exception, inst: self.forms.showMessageBox("Sorry", i18n("Error"), "%s" % inst) except:
def __init__(self, scriptaction,cli=False): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.cli=cli self.forms = Kross.module("forms") if not self.cli: # launched from inside KPlato self.proj = KPlato.project() else: # launched as a standalone script... print("opening doc...") filename=self.showImportDialog() KPlato.document().openUrl(filename) print( filename) self.proj=KPlato.project() self.dialog = self.forms.createDialog(i18n("Busy Information Export")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed datapage = self.dialog.addPage(i18n("Schedules"),i18n("Export Selected Schedule"),"document-export") self.scheduleview = KPlato.createScheduleListView(datapage) savepage = self.dialog.addPage(i18n("Save"),i18n("Export Busy Info File"),"document-save") self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kplatobusyinfoexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.ics|%(1)s\n*|%(2)s" % { '1' : i18n("Calendar"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doExport( self.proj ) except: self.forms.showMessageBox("Error", i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))
def __init__(self, scriptaction): self.scriptaction = scriptaction self.currentpath = self.scriptaction.currentPath() self.proj = KPlato.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(i18n("Project Information Export")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed datapage = self.dialog.addPage(i18n("Schedules"),i18n("Export Selected Schedule"),"document-export") self.scheduleview = KPlato.createScheduleListView(datapage) savepage = self.dialog.addPage(i18n("Save"),i18n("Export Project Info File"),"document-save") self.savewidget = self.forms.createFileWidget(savepage, "kfiledialog:///kplatoprojinfoexportsave") self.savewidget.setMode("Saving") self.savewidget.setFilter("*.txt|%(1)s\n*|%(2)s" % { '1' : i18n("Text Files"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doExport( self.proj ) except: self.forms.showMessageBox("Error", i18n("Error"), "%s" % "".join( traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2]) ))