def __init__(self, scriptaction): self.scriptaction = scriptaction #self.currentpath = self.scriptaction.currentPath() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog("Insert Shape") self.dialog.minimumWidth = 500 self.dialog.minimumHeight = 360 self.dialog.setButtons("Ok|Cancel") #self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed self.shapes = KWord.shapeKeys() 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.shapes ]))) self.widgetlist = widget["List"] if self.dialog.exec_loop(): self.doInsert()
def __init__(self, scriptaction): self.scriptaction = scriptaction #self.currentpath = self.scriptaction.currentPath() self.forms = Kross.module("forms") self.dialog = self.forms.createDialog("Insert Shape") self.dialog.minimumWidth = 500 self.dialog.minimumHeight = 360 self.dialog.setButtons("Ok|Cancel") #self.dialog.setFaceType("List") #Auto Plain List Tree Tabbed self.shapes = KWord.shapeKeys() 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.shapes ] ) ) ) self.widgetlist = widget["List"] if self.dialog.exec_loop(): self.doInsert()
#!/usr/bin/env kross # -*- coding: utf-8 -*- import KWord idx = 0 shapes = KWord.shapeKeys() for shapeId in shapes: frame = KWord.addFrame("myshape", shapeId) if frame != None: #frame.setTextRunAround(tableframe.RunThrough) frame.setPosition(idx % 6 * 80 + 20, 100 * idx + 20) #frame.resize(160, 160) idx += 1