Changeset 90 in main for trunk/plugins
- Timestamp:
- 07/15/10 13:12:32 (12 years ago)
- Location:
- trunk/plugins/openoffice
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/openoffice/Addons.xcu
r89 r90 48 48 </prop> 49 49 </node> 50 50 51 51 <node oor:name="m4" oor:op="replace"> 52 52 <prop oor:name="Title" oor:type="xs:string"> … … 60 60 </prop> 61 61 </node> 62 62 63 63 <node oor:name="m5" oor:op="replace"> 64 64 <prop oor:name="Title" oor:type="xs:string"> … … 72 72 </prop> 73 73 </node> 74 74 75 75 <node oor:name="m6" oor:op="replace"> 76 76 <prop oor:name="Title" oor:type="xs:string"> … … 85 85 </node> 86 86 87 87 <node oor:name="m7" oor:op="replace"> 88 <prop oor:name="Title" oor:type="xs:string"> 89 <value>Configure</value> 90 </prop> 91 <prop oor:name="URL" oor:type="xs:string"> 92 <value>service:org.example.OpenPLMConfigure</value> 93 </prop> 94 <prop oor:name="Target" oor:type="xs:string"> 95 <value>_self</value> 96 </prop> 97 </node> 98 88 99 </node> 89 100 </node> -
trunk/plugins/openoffice/openplm.py
r89 r90 43 43 self.desktop = None 44 44 self.documents = {} 45 46 data = self.get_conf_data() 47 if "server" in data: 48 type(self).SERVER = data["server"] 45 49 46 50 try: … … 164 168 documents[doc["id"]] = doc 165 169 data["documents"] = documents 170 self.save_conf(data) 171 172 def save_conf(self, data): 166 173 f = open(self.CONF_FILE, "w") 167 174 json.dump(data, f) … … 179 186 # file does not exist 180 187 return {} 188 189 def set_server(self, url): 190 data = self.get_conf_data() 191 data["server"] = url 192 type(self).SERVER = url 193 self.save_conf(data) 194 if self.username: 195 try: 196 self.login(self.username, self.password) 197 except ValueError: 198 pass 181 199 182 200 def get_managed_files(self): … … 198 216 if not data["documents"][str(doc["id"])]["files"]: 199 217 del data["documents"][str(doc["id"])] 200 f = open(self.CONF_FILE, "w") 201 json.dump(data, f) 202 f.close() 218 self.save_conf(data) 203 219 if delete and os.path.exists(path): 204 220 os.remove(path) … … 428 444 except ValueError, e: 429 445 print e 446 except: 447 traceback.print_exc() 448 449 class ConfigureDialog(Dialog): 450 451 def run(self): 452 smgr = self.ctx.ServiceManager 453 self.dialog = smgr.createInstanceWithContext( 454 'com.sun.star.awt.UnoControlDialogModel', self.ctx) 455 self.dialog.Width = 200 456 self.dialog.Height = 105 457 self.dialog.Title = 'Configure' 458 label = self.addWidget('url', 'FixedText', 5, 10, 60, 14, 459 Label="OpenPLM server's location:") 460 self.url_entry = self.addWidget('UrlEntry', 'Edit', 90, 10, 100, 14) 461 self.url_entry.Text = PLUGIN.SERVER 462 463 button = self.addWidget('configure', 'Button', 55, 85, 50, 14, 464 Label = 'Configure') 465 self.container = smgr.createInstanceWithContext( 466 'com.sun.star.awt.UnoControlDialog', self.ctx) 467 self.container.setModel(self.dialog) 468 self.container.getControl('configure').addActionListener(self) 469 toolkit = smgr.createInstanceWithContext( 470 'com.sun.star.awt.ExtToolkit', self.ctx) 471 self.container.setVisible(False) 472 self.container.createPeer(toolkit, None) 473 self.container.execute() 474 475 def actionPerformed(self, actionEvent): 476 try: 477 url = self.url_entry.Text 478 PLUGIN.set_server(url) 479 self.container.endExecute() 430 480 except: 431 481 traceback.print_exc() … … 790 840 traceback.print_exc() 791 841 842 class OpenPLMConfigure(unohelper.Base, XJobExecutor): 843 def __init__(self, ctx): 844 self.ctx = ctx 845 846 def trigger(self, args): 847 try: 848 desktop = self.ctx.ServiceManager.createInstanceWithContext( 849 'com.sun.star.frame.Desktop', self.ctx) 850 PLUGIN.set_desktop(desktop) 851 dialog = ConfigureDialog(self.ctx) 852 dialog.run() 853 except: 854 traceback.print_exc() 792 855 793 856 class OpenPLMCheckOut(unohelper.Base, XJobExecutor): … … 907 970 traceback.print_exc() 908 971 972 909 973 g_ImplementationHelper = unohelper.ImplementationHelper() 910 974 911 975 for cls in (OpenPLMLogin, OpenPLMCheckOut, OpenPLMDownload, OpenPLMForget, 912 OpenPLMCheckIn, OpenPLMRevise, OpenPLMAttach ):976 OpenPLMCheckIn, OpenPLMRevise, OpenPLMAttach, OpenPLMConfigure): 913 977 g_ImplementationHelper.addImplementation(cls, 914 978 'org.example.%s' % cls.__name__,
Note: See TracChangeset
for help on using the changeset viewer.