Changeset 75

Show
Ignore:
Timestamp:
Wed Jul 20 11:05:27 2005
Author:
fredrikc
Message:

Disable some widgets if no file open.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/transolution/xliffeditor/gtk_main.py

    r70 r75  
    135 135         self.cb_tu_constraint = g("tu_constraint")  
    136 136  
    137           self.document_operations = g("document_operations")  
    138 137         self.tu_closed_toolbar = g("tu_closed_toolbar")  
    139 138  
     
    158 157                                   'None':g("mb_skeleton_none")}  
    159 158  
    160           # disable document toolbar  
    161           self.document_operations.set_sensitive(False)  
    162 159         disable_when_tu_closed = ["tu_open_toolbar","tags_menu",  
    163 160                                   "commit_close1","cancel_close1",  
     
    168 165         self.widgets_to_disable_when_tu_open = [g("tu_nav_toolbar"),g("next_tu_menuitem"),g("previous_tu_menuitem")] #self.tu_closed_toolbar]  
    169 166  
      167         self.widgets_to_disable_if_no_file_open = [g(w) for w in ['edit_menu','view_menu','tu_menu','tags_menu','document_operations']]  
      168  
    170 169         # setup combobox TU prev/next constraint  
    171 170         for i,value in constraint_dict.items():  
     
    187 186             self.editor_font_desc = pango.FontDescription(settings.fonts.editor_font)  
    188 187          
      188         self._updateGui()  
    189 189  
    190 190     # Document Formatter change handlers  
     
    352 352         # Set selection to last page  
    353 353         notebook.set_current_page(notebook.get_n_pages()-1)  
    354           # Enable tu_toolbar  
    355           self.document_operations.set_sensitive(True)  
    356 354         self._updateGui()  
    357 355         print "Done"  
     
    362 360         print "_updateGui"  
    363 361         self.interactive = False  
      362  
      363         # check if no file is open  
      364         if self.notebook.get_n_pages() ==0:  
      365             # disable file conditional widgets  
      366             for w in self.widgets_to_disable_if_no_file_open:  
      367                 w.set_sensitive(False)  
      368             self.interactive = True  
      369             return  
      370  
      371         # enable file conditional widgets  
      372         for w in self.widgets_to_disable_if_no_file_open:  
      373             w.set_sensitive(True)  
      374  
    364 375         doc_model = self.docpane.doc_model  
    365 376          
     
    554 565         # or we will remove an extra page.  
    555 566         o.close()  
    556    
    557           if self.notebook.get_n_pages() ==0:  
    558               # disable tu toolbar  
    559               self.document_operations.set_sensitive(False)  
    560    
      567         self._updateGui()  
      568          
    561 569     def onFileOpen(self,*args):  
    562 570         print "OPEN!"  
  • trunk/transolution/xliffeditor/glade/xliffeditor.glade

    r70 r75  
    97 97  
    98 98           <child>  
    99               <widget class="GtkMenuItem" id="menuitem5">  
      99             <widget class="GtkMenuItem" id="edit_menu">  
    99 99               <property name="visible">True</property>  
    100 100               <property name="label" translatable="yes">_Edit</property>  
     
    103 103  
    104 104               <child>  
    105                   <widget class="GtkMenu" id="menuitem5_menu">  
      105                 <widget class="GtkMenu" id="edit_menu_menu">  
    105 105  
    106 106                   <child>  
     
    203 203  
    204 204           <child>  
    205               <widget class="GtkMenuItem" id="menuitem6">  
      205             <widget class="GtkMenuItem" id="view_menu">  
    205 205               <property name="visible">True</property>  
    206 206               <property name="label" translatable="yes">_View</property>  
     
    209 209  
    210 210               <child>  
    211                   <widget class="GtkMenu" id="menuitem6_menu">  
      211                 <widget class="GtkMenu" id="view_menu_menu">  
    211 211  
    212 212                   <child>  
     
    216 216                       <property name="label" translatable="yes">Source</property>  
    217 217                       <property name="use_underline">True</property>  
    218                         <property name="active">False</property>  
      218                       <property name="active">True</property>  
    218 218                       <signal name="activate" handler="onShowSource" last_modification_time="Wed, 18 May 2005 08:42:02 GMT"/>  
    219 219                     </widget>  
     
    226 226                       <property name="label" translatable="yes">Target</property>  
    227 227                       <property name="use_underline">True</property>  
    228                         <property name="active">False</property>  
      228                       <property name="active">True</property>  
    228 228                       <property name="group">mb_show_source</property>  
    229 229                       <signal name="activate" handler="onShowTarget" last_modification_time="Wed, 18 May 2005 08:42:02 GMT"/>  
     
    272 272                                       <property name="label" translatable="yes">Full+tagid</property>  
    273 273                                       <property name="use_underline">True</property>  
    274                                         <property name="active">False</property>  
      274                                       <property name="active">True</property>  
    274 274                                       <signal name="activate" handler="onEditorFormatterFull" last_modification_time="Sat, 05 Feb 2005 00:51:06 GMT"/>  
    275 275                                       <accelerator key="F1" modifiers="GDK_CONTROL_MASK" signal="activate"/>  
     
    283 283                                       <property name="label" translatable="yes">Full</property>  
    284 284                                       <property name="use_underline">True</property>  
    285                                         <property name="active">False</property>  
      285                                       <property name="active">True</property>  
    285 285                                       <property name="group">mb_editor_formatter_full</property>  
    286 286                                       <signal name="activate" handler="onEditorFormatterMedium" last_modification_time="Sat, 05 Feb 2005 00:51:06 GMT"/>  
     
    343 343                                       <property name="label" translatable="yes">Full</property>  
    344 344                                       <property name="use_underline">True</property>  
    345                                         <property name="active">False</property>  
      345                                       <property name="active">True</property>  
    345 345                                       <signal name="activate" handler="onSkeletonFull" last_modification_time="Tue, 17 May 2005 21:21:08 GMT"/>  
    346 346                                     </widget>  
     
    353 353                                       <property name="label" translatable="yes">Minimal</property>  
    354 354                                       <property name="use_underline">True</property>  
    355                                         <property name="active">False</property>  
      355                                       <property name="active">True</property>  
    355 355                                       <property name="group">mb_skeleton_full</property>  
    356 356                                       <signal name="activate" handler="onSkeletonMinimal" last_modification_time="Tue, 17 May 2005 21:21:08 GMT"/>  
     
    388 388                                       <property name="label" translatable="yes">Full</property>  
    389 389                                       <property name="use_underline">True</property>  
    390                                         <property name="active">False</property>  
      390                                       <property name="active">True</property>  
    390 390                                       <signal name="activate" handler="onDocumentFormatterFull" last_modification_time="Sat, 05 Feb 2005 00:51:06 GMT"/>  
    391 391                                       <accelerator key="F5" modifiers="GDK_CONTROL_MASK" signal="activate"/>  
     
    399 399                                       <property name="label" translatable="yes">Medium</property>  
    400 400                                       <property name="use_underline">True</property>  
    401                                         <property name="active">False</property>  
      401                                       <property name="active">True</property>  
    401 401                                       <property name="group">mb_formatter_full</property>  
    402 402                                       <signal name="activate" handler="onDocumentFormatterMedium" last_modification_time="Sat, 05 Feb 2005 00:51:06 GMT"/>  
     
    477 477  
    478 478           <child>  
    479               <widget class="GtkMenuItem" id="tu1">  
      479             <widget class="GtkMenuItem" id="tu_menu">  
    479 479               <property name="visible">True</property>  
    480 480               <property name="label" translatable="yes">_TU</property>  
     
    484 484  
    485 485               <child>  
    486                   <widget class="GtkMenu" id="tu1_menu">  
      486                 <widget class="GtkMenu" id="tu_menu_menu">  
    486 486  
    487 487                   <child>  
     
    495 495  
    496 496                       <child internal-child="image">  
    497                           <widget class="GtkImage" id="image68">  
      497                         <widget class="GtkImage" id="image69">  
    497 497                           <property name="visible">True</property>  
    498                             <property name="stock">gtk-go-forward</property>  
      498                           <property name="stock">gtk-media-forward</property>  
      499                           <property name="icon_size">1</property>  
    499 500                           <property name="xalign">0.5</property>  
    500 501                           <property name="yalign">0.5</property>  
     
    516 517  
    517 518                       <child internal-child="image">  
    518                           <widget class="GtkImage" id="image69">  
      519                         <widget class="GtkImage" id="image70">  
    518 519                           <property name="visible">True</property>  
    519 520                           <property name="stock">gtk-go-back</property>  
     
    804 805  
    805 806           <child>  
    806               <widget class="GtkMenuItem" id="tm1">  
      807             <widget class="GtkMenuItem" id="tm_menu">  
    806 807               <property name="visible">True</property>  
    807 808               <property name="label" translatable="yes">TM</property>  
     
    811 812  
    812 813               <child>  
    813                   <widget class="GtkMenu" id="tm1_menu">  
      814                 <widget class="GtkMenu" id="tm_menu_menu">  
    813 814  
    814 815                   <child>