def __init__(self, scriptaction): self.scriptaction = scriptaction #self.currentpath = self.scriptaction.currentPath() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog("Execute Action") self.dialog.minimumWidth = 500 self.dialog.minimumHeight = 360 self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("Plain") #Auto Plain List Tree Tabbed self.objects = [ ('application', KWord.application()), ('shell', KWord.shell()), ('mainwindow', KWord.mainWindow()), ('document', KWord.document()), ] self.actions = [] for obj in self.objects: for s in dir(obj[1]): if s.startswith('slot'): self.actions.append("%s.%s" % (obj[0], s)) page = self.dialog.addPage("", "") widget = self.forms.createWidgetFromUI( page, '<ui version="4.0" >' ' <class>Form</class>' ' <widget class="QWidget" name="Form" >' ' <layout class="QHBoxLayout" >' ' <item>' ' <widget class="QListWidget" name="List">' ' <property name="currentRow"><number>%i</number></property>' ' %s' ' </widget>' ' </item>' ' </layout>' ' </widget>' '</ui>' % (0, ''.join([ '<item><property name="text" ><string>%s</string></property></item>' % s for s in self.actions ]))) self.widgetlist = widget["List"] if self.dialog.exec_loop(): self.execAction()
def __init__(self, scriptaction): self.scriptaction = scriptaction #self.currentpath = self.scriptaction.currentPath() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog("Execute Action") self.dialog.minimumWidth = 500 self.dialog.minimumHeight = 360 self.dialog.setButtons("Ok|Cancel") self.dialog.setFaceType("Plain") #Auto Plain List Tree Tabbed self.objects = [ ('application', KWord.application()), ('shell', KWord.shell()), ('mainwindow', KWord.mainWindow()), ('document', KWord.document()), ] self.actions = [] for obj in self.objects: for s in dir(obj[1]): if s.startswith('slot'): self.actions.append( "%s.%s" % (obj[0],s) ) page = self.dialog.addPage("", "") widget = self.forms.createWidgetFromUI(page, '<ui version="4.0" >' ' <class>Form</class>' ' <widget class="QWidget" name="Form" >' ' <layout class="QHBoxLayout" >' ' <item>' ' <widget class="QListWidget" name="List">' ' <property name="currentRow"><number>%i</number></property>' ' %s' ' </widget>' ' </item>' ' </layout>' ' </widget>' '</ui>' % ( 0, ''.join( [ '<item><property name="text" ><string>%s</string></property></item>' % s for s in self.actions ] ) ) ) self.widgetlist = widget["List"] if self.dialog.exec_loop(): self.execAction()
#!/usr/bin/env kross # -*- coding: utf-8 -*- import KWord, time # fetch the main window komainwindow = KWord.shell() # set the statusbar text komainwindow.slotSetStatusBarText("This is the sample_progressbar.py script") try: # increment the progressbar from 0% to 100% for i in range(1, 101): komainwindow.slotProgress(i) # wait some seconds else we are to fast ;) time.sleep(0.1) finally: # reset the statusbar-text and the progressbar. komainwindow.slotSetStatusBarText("") komainwindow.slotProgress(-1)
#!/usr/bin/env kross # -*- coding: utf-8 -*- import KWord, time # fetch the main window komainwindow = KWord.shell() # set the statusbar text komainwindow.slotSetStatusBarText("This is the sample_progressbar.py script") try: # increment the progressbar from 0% to 100% for i in range(1,101): komainwindow.slotProgress(i) # wait some seconds else we are to fast ;) time.sleep(0.1) finally: # reset the statusbar-text and the progressbar. komainwindow.slotSetStatusBarText("") komainwindow.slotProgress(-1)