Changeset 85 in main for trunk/plugins
- Timestamp:
- 07/13/10 16:23:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/openoffice/openplm.py
r84 r85 20 20 from com.sun.star.awt.tree import XTreeExpansionListener 21 21 from com.sun.star.view import XSelectionChangeListener 22 from com.sun.star.view.SelectionType import SINGLE 22 23 23 24 … … 217 218 218 219 def load_file(self, doc, doc_file_id, path): 219 gedit.commands.load_uri(self._window, "file://" + path, None, -1) 220 gdoc = self._window.get_active_document() 220 document = desktop.loadComponentFromURL("file://" + path ,"_blank", 0, ()) 221 221 gdoc.set_data("openplm_doc", doc) 222 222 gdoc.set_data("openplm_file_id", doc_file_id) 223 223 gdoc.set_data("openplm_path", path) 224 if not gdoc.get_data("openplm_label"):225 tab = self._window.get_active_tab()226 notebook = tab.get_parent()227 tab_label = notebook.get_tab_label(tab)228 box = tab_label.get_children()[0].get_child()229 # tag already present if we refresh the file230 label = gtk.Label("[PLM]")231 label.show()232 box.pack_start(label)233 gdoc.set_data("openplm_label", label)234 224 return gdoc 235 225 … … 527 517 528 518 self.tree = self.addWidget('tree', 'tree.TreeControlModel', 529 self.PAD, y + h +5, self.WIDTH-2*self.PAD, self.HEIGHT- (y+ h + 20))519 self.PAD, y + h +5, self.WIDTH-2*self.PAD, self.HEIGHT- (y+ 2*h + 20)) 530 520 531 521 self.tree_model = self.createService("com.sun.star.awt.tree.MutableTreeDataModel") … … 533 523 self.tree_model.setRoot(self.tree_root) 534 524 self.tree.DataModel = self.tree_model 535 525 self.tree.SelectionType = SINGLE 526 527 y = self.HEIGHT - self.PAD - h 528 self.action_button = self.addWidget('action_button', 'Button', x, y, w, h, 529 Label = self.ACTION_NAME) 536 530 #self.tree.addSelectionChangeListener(self) 537 531 … … 540 534 self.container.setModel(self.dialog) 541 535 self.container.getControl('search_button').addActionListener(self) 536 self.container.getControl('action_button').addActionListener(self) 542 537 self.container.getControl('type_entry').addItemListener(self) 543 538 self.container.getControl('tree').addTreeExpansionListener(self) … … 585 580 self.search_button.PositionX = x 586 581 self.search_button.PositionY = y 582 pos = self.tree.PositionY 583 self.tree.PositionY = y + h + 5 584 self.tree.Height -= self.tree.PositionY - pos 587 585 588 586 def actionPerformed(self, actionEvent): 589 587 try: 590 self.search() 588 if actionEvent.Source == self.container.getControl('search_button'): 589 self.search() 590 elif actionEvent.Source == self.container.getControl('action_button'): 591 node = self.container.getControl('tree').getSelection() 592 doc = self.nodes[node.getParent().getDisplayValue()] 593 doc_file = doc["files"][node.getParent().getIndex(node)] 594 self.do_action(doc, doc_file) 591 595 except: 592 596 traceback.print_exc() … … 608 612 node = self.tree_model.createNode(f["filename"], False) 609 613 event.Node.appendChild(node) 614 self.container.getPeer().invalidate(UPDATE|1) 610 615 611 616 def display_results(self, results): … … 618 623 self.tree_root.appendChild(node) 619 624 self.nodes[node.getDisplayValue()] = res 625 self.container.getPeer().invalidate(UPDATE|1) 620 626 621 627 def search(self, *args): … … 632 638 self.display_results(PLUGIN.get_data("api/search/?%s" % get)["objects"]) 633 639 640 def do_action(self, doc, doc_file): 641 print doc, doc_file 634 642 635 643 class CheckOutDialog(SearchDialog): 636 644 TITLE = "Check-out..." 637 645 ACTION_NAME = "Check-out" 646 647 def do_action(self, doc, doc_file): 648 PLUGIN.check_out(doc, doc_file) 649 self.container.endExecute() 638 650 639 651 class OpenPLMLogin(unohelper.Base, XJobExecutor):
Note: See TracChangeset
for help on using the changeset viewer.