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("Busy Information Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed openpage = self.dialog.addPage(i18n("Open"),i18n("Import Busy Info File"),"document-open") self.openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///kplatobusyinfoimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.rbi|%(1)s\n*|%(2)s" % { '1' : i18n("Resource Busy Information"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doImport( 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.proj = KPlato.project() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog(i18n("Resources Import")) self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed #TODO add options page ( import Calendars? Select calendars, Select resources... ) openpage = self.dialog.addPage(i18n("Open"),i18n("KPlato Resources"),"document-open") self.openwidget = self.forms.createFileWidget(openpage, "kfiledialog:///kplatresourcesimportopen") self.openwidget.setMode("Opening") self.openwidget.setFilter("*.kplato|%(1)s\n*|%(2)s" % { '1' : i18n("Resource Busy Information"), '2' : i18n("All Files") } ) if self.dialog.exec_loop(): try: self.doImport( self.proj ) except Exception, inst: self.forms.showMessageBox("Sorry", i18n("Error"), "%s" % inst) except:
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]) ))
#!/usr/bin/env kross # -*- coding: utf-8 -*- import os, datetime, sys, traceback, pickle import Kross, KPlato #TODO some ui KPlato.project().clearAllExternalAppointments();
for interval in lst: print "%-20s %-30s %-30s %8s" % ( name, interval[0], interval[1], interval[2] ) name = "" def printProjectCalendars( proj ): for c in range( proj.calendarCount() ): printChildCalendars( proj.calendarAt ( c ) ) def printChildCalendars( calendar ): print calendar.name() for c in range( calendar.childCount() ): printChildCalendars( calendar.childAt ( c ) ) #------------------------ proj = KPlato.project() sid = -1; # get a schedule id if proj.scheduleCount() > 0: sid = proj.scheduleAt( 0 ).id() print "Using schedule id: %-3s" % ( sid ) print nodeprops = [['NodeWBSCode', 'DisplayRole'], ['NodeName', 'DisplayRole'], ['NodeType', 'DisplayRole'], ['NodeResponsible', 'DisplayRole'], ['NodeStatus', 'EditRole'] ] print "Print tasks and milestones in arbitrary order:" # print the localized headers for prop in nodeprops: print "%-25s" % (proj.nodeHeaderData( prop ) ), print
def __init__(self, scriptaction): proj = KPlato.project() self.check(proj)
print "%-10s %-25s %-10s" % (sch.id(), sch.name(), sch.isScheduled()) print "sch ( %s )" % ";".join(dir(sch)) print sch.appointments() for i in range(sch.childCount()): printSchedule(sch.childAt(i)) forms = Kross.module("forms") print "forms: ", dir(forms) for mn in dir(KPlato): m = getattr(KPlato, mn) print mn, "===>", m.__doc__ KPlato.document().openUrl("/home/dimon/work/python/koffice-scripts/kplato/test_project.kplato") project = KPlato.project() print dir(KPlato.data) sid = -1 # get a schedule id if project.scheduleCount() > 0: sched = project.scheduleAt(0) sid = sched.id() print "appointments?? : ", KPlato.data(sched, "m_appointments") print project.id(), KPlato.data(project, "NodeName") printSchedules(project) nodeprops = [