Changeset 92 in main for trunk/plugins
- Timestamp:
- 07/15/10 15:10:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/openoffice/openplm.py
r91 r92 306 306 class Dialog(unohelper.Base, XActionListener): 307 307 308 TITLE = " Search"308 TITLE = "..." 309 309 ACTION_NAME = "..." 310 310 … … 318 318 self.ctx = ctx 319 319 self.msg = None 320 320 smgr = self.ctx.ServiceManager 321 self.dialog = smgr.createInstanceWithContext( 322 'com.sun.star.awt.UnoControlDialogModel', self.ctx) 323 self.dialog.Width = self.WIDTH 324 self.dialog.Height = self.HEIGHT 325 self.dialog.Title = self.TITLE 326 321 327 def addWidget(self, name, type, x, y, w, h, **kwargs): 322 328 if "." in type: … … 382 388 return widget 383 389 384 385 390 def run(self): 386 391 pass … … 390 395 391 396 class LoginDialog(Dialog): 392 397 HEIGHT = 105 398 TITLE = 'Login' 399 393 400 def run(self): 394 401 smgr = self.ctx.ServiceManager 395 self.dialog = smgr.createInstanceWithContext(396 'com.sun.star.awt.UnoControlDialogModel', self.ctx)397 self.dialog.Width = 200398 self.dialog.Height = 105399 self.dialog.Title = 'Login'400 402 label = self.addWidget('Username', 'FixedText', 5, 10, 60, 14, 401 Label ='Username:')403 Label='Username:') 402 404 self.username = self.addWidget('UsernameEntry', 'Edit', 90, 10, 100, 14) 403 405 label = self.addWidget('password', 'FixedText', 5, 30, 60, 14, 404 Label ='Password:')406 Label='Password:') 405 407 self.password = self.addWidget('PasswordEntry', 'Edit', 90, 30, 100, 14, 406 408 EchoChar=ord('*')) 407 409 408 410 button = self.addWidget('login', 'Button', 55, 85, 50, 14, 409 Label ='Login')411 Label='Login') 410 412 self.container = smgr.createInstanceWithContext( 411 413 'com.sun.star.awt.UnoControlDialog', self.ctx) … … 432 434 class ConfigureDialog(Dialog): 433 435 436 TITLE = "Conffigure" 437 HEIGHT = 105 438 434 439 def run(self): 435 440 smgr = self.ctx.ServiceManager 436 self.dialog = smgr.createInstanceWithContext(437 'com.sun.star.awt.UnoControlDialogModel', self.ctx)438 self.dialog.Width = 200439 self.dialog.Height = 105440 self.dialog.Title = 'Configure'441 441 label = self.addWidget('url', 'FixedText', 5, 10, 60, 14, 442 442 Label="OpenPLM server's location:") … … 445 445 446 446 button = self.addWidget('configure', 'Button', 55, 85, 50, 14, 447 Label ='Configure')447 Label='Configure') 448 448 self.container = smgr.createInstanceWithContext( 449 449 'com.sun.star.awt.UnoControlDialog', self.ctx) … … 480 480 ROW_PAD = 2 481 481 482 483 482 def get_position(self, row, column): 484 483 if column == 1: … … 497 496 498 497 smgr = self.ctx.ServiceManager 499 self.dialog = smgr.createInstanceWithContext(500 'com.sun.star.awt.UnoControlDialogModel', self.ctx)501 self.dialog.Width = self.WIDTH502 self.dialog.Height = self.HEIGHT503 self.dialog.Title = self.TITLE504 498 505 499 fields = [("type", 'ListBox'), … … 541 535 self.action_button = self.addWidget('action_button', 'Button', x, y, w, h, 542 536 Label = self.ACTION_NAME) 543 #self.tree.addSelectionChangeListener(self)544 537 545 538 self.container = smgr.createInstanceWithContext( … … 563 556 temp = {} 564 557 for field, entry in self.advanced_fields: 565 temp[field["name"]] = self.get_value(entry, field)566 entry.PositionX = -1000567 entry.PositionY = -1000558 name = field["name"] 559 temp[name] = self.get_value(entry, field) 560 self.container.getControl(entry.Name).setVisible(False) 568 561 entry.dispose() 569 562 self.dialog.removeByName(entry.Name) 570 label = self.dialog.getByName("%s_label" % field["name"]) 563 label = self.dialog.getByName("%s_label" % name) 564 self.container.getControl(label.Name).setVisible(False) 571 565 label.dispose() 572 label.PositionX = -1000 573 label.PositionY = -1000 574 self.dialog.removeByName("%s_label" % field["name"]) 566 self.dialog.removeByName(label.Name) 575 567 self.advanced_fields = [] 576 j= len(self.fields)568 row = len(self.fields) 577 569 for i, field in enumerate(fields): 578 text = field["label"] 579 x, y, w, h = self.get_position(i + j, 1) 580 label = self.addWidget('%s_label' % field["name"], 'FixedText', 581 x, y, w, h, 582 Label = '%s:' % text.capitalize()) 583 x, y, w, h = self.get_position(i + j, 2) 570 text, name = field["label"], field["name"] 571 x, y, w, h = self.get_position(i + row, 1) 572 label = self.addWidget('%s_label' % name, 'FixedText', 573 x, y, w, h, Label='%s:' % text.capitalize()) 574 x, y, w, h = self.get_position(i + row, 2) 584 575 widget = self.field_to_widget(field, x, y, w, h) 585 if field["name"]in temp:586 self.set_value(widget, temp[ field["name"]], field)576 if name in temp: 577 self.set_value(widget, temp[name], field) 587 578 self.advanced_fields.append((field, widget)) 588 579 if hasattr(self, 'container'): 589 580 self.container.getPeer().invalidate(UPDATE|1) 590 #self.container.setVisible(True) 591 x, y, w, h = self.get_position(len(self.fields)+len(self.advanced_fields)+1, 2) 581 x, y, w, h = self.get_position(row + i + 2, 2) 592 582 self.search_button.PositionX = x 593 583 self.search_button.PositionY = y … … 685 675 def run(self): 686 676 smgr = self.ctx.ServiceManager 687 self.dialog = smgr.createInstanceWithContext(688 'com.sun.star.awt.UnoControlDialogModel', self.ctx)689 self.dialog.Width = self.WIDTH690 self.dialog.Height = self.HEIGHT691 self.dialog.Title = self.TITLE692 677 693 678 text = "%s|%s|%s" % (self.doc["reference"], self.doc["revision"], … … 739 724 def run(self): 740 725 smgr = self.ctx.ServiceManager 741 self.dialog = smgr.createInstanceWithContext(742 'com.sun.star.awt.UnoControlDialogModel', self.ctx)743 self.dialog.Width = self.WIDTH744 self.dialog.Height = self.HEIGHT745 self.dialog.Title = self.TITLE746 726 747 727 text = "%s|" % self.doc["reference"] … … 816 796 817 797 WIDTH = 200 818 HEIGHT = 300798 HEIGHT = 200 819 799 PAD = 5 820 800 ROW_HEIGHT = 15 … … 827 807 828 808 smgr = self.ctx.ServiceManager 829 self.dialog = smgr.createInstanceWithContext(830 'com.sun.star.awt.UnoControlDialogModel', self.ctx)831 self.dialog.Width = self.WIDTH832 self.dialog.Height = self.HEIGHT833 self.dialog.Title = self.TITLE834 809 835 810 fields = [("type", 'ListBox'), … … 852 827 self.advanced_fields = [] 853 828 self.display_fields(self.TYPE) 854 855 x, y, w, h = self.get_position(len(self.fields)+len(self.advanced_fields), 1) 856 self.filename_label = self.addWidget('filenameLabel', 'FixedText', x, y, w, h, 857 Label="Filename") 858 x, y, w, h = self.get_position(len(self.fields)+len(self.advanced_fields), 2) 829 830 row = len(self.fields) + len(self.advanced_fields) 831 x, y, w, h = self.get_position(row, 1) 832 self.filename_label = self.addWidget('filenameLabel', 'FixedText', 833 x, y, w, h, Label="Filename") 834 x, y, w, h = self.get_position(row, 2) 859 835 self.filename_entry = self.addWidget('filename', 'Edit', x, y, w, h) 860 861 x, y, w, h = self.get_position(len(self.fields)+len(self.advanced_fields)+1, 1) 836 x, y, w, h = self.get_position(row + 1, 1) 862 837 self.unlock_button = self.addWidget('unlock', 'CheckBox', x, y, w, h, 863 838 Label="Unlock ?") 864 x, y, w, h = self.get_position( len(self.fields)+len(self.advanced_fields)+2, 1)839 x, y, w, h = self.get_position(row + 2, 2) 865 840 self.action_button = self.addWidget('action_button', 'Button', x, y, w, h, 866 Label =self.ACTION_NAME)841 Label=self.ACTION_NAME) 867 842 868 843 self.container = smgr.createInstanceWithContext( … … 881 856 temp = {} 882 857 for field, entry in self.advanced_fields: 883 temp[field["name"]] = self.get_value(entry, field) 884 self.container.getControl("%s_entry" % field["name"]).setVisible(False) 858 name = field["name"] 859 temp[name] = self.get_value(entry, field) 860 self.container.getControl(entry.Name).setVisible(False) 885 861 entry.dispose() 886 862 self.dialog.removeByName(entry.Name) 887 label = self.dialog.getByName("%s_label" % field["name"])888 self.container.getControl( "%s_label" % field["name"]).setVisible(False)863 label = self.dialog.getByName("%s_label" % name) 864 self.container.getControl(label.Name).setVisible(False) 889 865 label.dispose() 890 self.dialog.removeByName( "%s_label" % field["name"])866 self.dialog.removeByName(label.Name) 891 867 self.advanced_fields = [] 892 j= len(self.fields)868 row = len(self.fields) 893 869 for i, field in enumerate(fields): 894 text = field["label"] 895 x, y, w, h = self.get_position(i + j, 1) 896 label = self.addWidget('%s_label' % field["name"], 'FixedText', 897 x, y, w, h, 898 Label = '%s:' % text.capitalize()) 899 x, y, w, h = self.get_position(i + j, 2) 870 text, name = field["label"], field["name"] 871 x, y, w, h = self.get_position(i + row, 1) 872 label = self.addWidget('%s_label' % name, 'FixedText', 873 x, y, w, h, Label='%s:' % text.capitalize()) 874 x, y, w, h = self.get_position(i + row, 2) 900 875 widget = self.field_to_widget(field, x, y, w, h) 901 if field["name"]in temp:902 self.set_value(widget, temp[ field["name"]], field)876 if name in temp: 877 self.set_value(widget, temp[name], field) 903 878 self.advanced_fields.append((field, widget)) 904 879 if hasattr(self, 'container'): 905 880 self.container.getPeer().invalidate(UPDATE|1) 906 j = len(self.fields) + len(self.advanced_fields) 907 x, y, w, h = self.get_position(j, 1) 908 self.filename_label.PositionY= y 909 self.filename_entry.PositionY= y 910 x, y, w, h = self.get_position(j + 1, 1) 911 self.unlock_button.PositionY= y 912 x, y, w, h = self.get_position(j + 2, 1) 913 self.action_button.PositionY= y 881 x, y, w, h = self.get_position(row + i + 1, 1) 882 self.filename_label.PositionY = y 883 self.filename_entry.PositionY = y 884 x, y, w, h = self.get_position(row + i + 2, 1) 885 self.unlock_button.PositionY = y 886 x, y, w, h = self.get_position(row + i + 3, 1) 887 self.action_button.PositionY = y 914 888 915 889 def actionPerformed(self, actionEvent): … … 941 915 traceback.print_exc() 942 916 943 def do_action(self, doc, doc_file): 944 print doc, doc_file 945 946 class OpenPLMLogin(unohelper.Base, XJobExecutor): 917 918 class Job(unohelper.Base, XJobExecutor): 947 919 def __init__(self, ctx): 948 920 self.ctx = ctx 921 922 class OpenPLMLogin(Job): 949 923 950 924 def trigger(self, args): … … 958 932 traceback.print_exc() 959 933 960 class OpenPLMConfigure(unohelper.Base, XJobExecutor): 961 def __init__(self, ctx): 962 self.ctx = ctx 934 class OpenPLMConfigure(Job): 963 935 964 936 def trigger(self, args): … … 972 944 traceback.print_exc() 973 945 974 class OpenPLMCheckOut(unohelper.Base, XJobExecutor): 975 def __init__(self, ctx): 976 self.ctx = ctx 946 class OpenPLMCheckOut(Job): 977 947 978 948 def trigger(self, args): … … 986 956 traceback.print_exc() 987 957 988 class OpenPLMDownload(unohelper.Base, XJobExecutor): 989 def __init__(self, ctx): 990 self.ctx = ctx 991 958 class OpenPLMDownload(Job): 959 992 960 def trigger(self, args): 993 961 try: … … 1000 968 traceback.print_exc() 1001 969 1002 class OpenPLMForget(unohelper.Base, XJobExecutor): 1003 def __init__(self, ctx): 1004 self.ctx = ctx 970 class OpenPLMForget(Job): 1005 971 1006 972 def trigger(self, args): … … 1013 979 traceback.print_exc() 1014 980 1015 class OpenPLMCheckIn(unohelper.Base, XJobExecutor): 1016 def __init__(self, ctx): 1017 self.ctx = ctx 1018 981 class OpenPLMCheckIn(Job): 982 1019 983 def trigger(self, args): 1020 984 try: … … 1035 999 traceback.print_exc() 1036 1000 1037 class OpenPLMRevise(unohelper.Base, XJobExecutor): 1038 def __init__(self, ctx): 1039 self.ctx = ctx 1001 class OpenPLMRevise(Job): 1040 1002 1041 1003 def trigger(self, args): … … 1068 1030 traceback.print_exc() 1069 1031 1070 class OpenPLMAttach(unohelper.Base, XJobExecutor): 1071 def __init__(self, ctx): 1072 self.ctx = ctx 1032 class OpenPLMAttach(Job): 1073 1033 1074 1034 def trigger(self, args): … … 1088 1048 traceback.print_exc() 1089 1049 1090 class OpenPLMCreate(unohelper.Base, XJobExecutor): 1091 def __init__(self, ctx): 1092 self.ctx = ctx 1093 1050 class OpenPLMCreate(Job): 1051 1094 1052 def trigger(self, args): 1095 1053 try:
Note: See TracChangeset
for help on using the changeset viewer.