@@ -159,19 +159,15 @@ def __init__(self, pdata, dbstate, uistate, nav_group=0):
159
159
# dict {handle, tooltip_str} of tooltips in markup format
160
160
self .tags_tooltips = {}
161
161
162
- self .additional_uis .append (self .additional_ui () )
162
+ self .additional_uis .append (self .additional_ui )
163
163
self .define_print_actions ()
164
164
165
165
def define_print_actions (self ):
166
166
"""
167
167
Associate the print button to the PrintView action.
168
168
"""
169
- self ._add_action ('PrintView' , 'document-print' , _ ("_Print..." ),
170
- accel = "<PRIMARY>P" ,
171
- tip = _ ("Save the dot file for a later print.\n "
172
- "This will save a .gv file and a svg file.\n "
173
- "You must select a .gv file" ),
174
- callback = self .printview )
169
+ self ._add_action ('PrintView' , self .printview , "<PRIMARY>P" )
170
+ self ._add_action ('PRIMARY-J' , self .jump , '<PRIMARY>J' )
175
171
176
172
def _connect_db_signals (self ):
177
173
"""
@@ -223,39 +219,96 @@ def build_tree(self):
223
219
"""
224
220
pass
225
221
226
- def additional_ui (self ):
227
- """
228
- Specifies the UIManager XML code that defines the menus and buttons
229
- associated with the interface.
230
- """
231
- return '''<ui>
232
- <menubar name="MenuBar">
233
- <menu action="GoMenu">
234
- <placeholder name="CommonGo">
235
- <menuitem action="Back"/>
236
- <menuitem action="Forward"/>
237
- <separator/>
238
- <menuitem action="HomePerson"/>
239
- <separator/>
240
- </placeholder>
241
- </menu>
242
- <menu action="EditMenu">
243
- <placeholder name="CommonEdit">
244
- <menuitem action="PrintView"/>
245
- </placeholder>
246
- </menu>
247
- </menubar>
248
- <toolbar name="ToolBar">
249
- <placeholder name="CommonNavigation">
250
- <toolitem action="Back"/>
251
- <toolitem action="Forward"/>
252
- <toolitem action="HomePerson"/>
253
- </placeholder>
254
- <placeholder name="CommonEdit">
255
- <toolitem action="PrintView"/>
256
- </placeholder>
257
- </toolbar>
258
- </ui>'''
222
+ additional_ui = [ # Defines the UI string for UIManager
223
+ '''
224
+ <placeholder id="CommonGo">
225
+ <section>
226
+ <item>
227
+ <attribute name="action">win.Back</attribute>
228
+ <attribute name="label" translatable="yes">_Back</attribute>
229
+ </item>
230
+ <item>
231
+ <attribute name="action">win.Forward</attribute>
232
+ <attribute name="label" translatable="yes">_Forward</attribute>
233
+ </item>
234
+ </section>
235
+ <section>
236
+ <item>
237
+ <attribute name="action">win.HomePerson</attribute>
238
+ <attribute name="label" translatable="yes">_Home</attribute>
239
+ </item>
240
+ </section>
241
+ </placeholder>
242
+ ''' ,
243
+ '''
244
+ <section id='CommonEdit' groups='RW'>
245
+ <item>
246
+ <attribute name="action">win.PrintView</attribute>
247
+ <attribute name="label" translatable="yes">_Print...</attribute>
248
+ </item>
249
+ </section>
250
+ ''' , # Following are the Toolbar items
251
+ '''
252
+ <placeholder id='CommonNavigation'>
253
+ <child groups='RO'>
254
+ <object class="GtkToolButton">
255
+ <property name="icon-name">go-previous</property>
256
+ <property name="action-name">win.Back</property>
257
+ <property name="tooltip_text" translatable="yes">'''
258
+ '''Go to the previous object in the history</property>
259
+ <property name="label" translatable="yes">_Back</property>
260
+ <property name="use-underline">True</property>
261
+ </object>
262
+ <packing>
263
+ <property name="homogeneous">False</property>
264
+ </packing>
265
+ </child>
266
+ <child groups='RO'>
267
+ <object class="GtkToolButton">
268
+ <property name="icon-name">go-next</property>
269
+ <property name="action-name">win.Forward</property>
270
+ <property name="tooltip_text" translatable="yes">'''
271
+ '''Go to the next object in the history</property>
272
+ <property name="label" translatable="yes">_Forward</property>
273
+ <property name="use-underline">True</property>
274
+ </object>
275
+ <packing>
276
+ <property name="homogeneous">False</property>
277
+ </packing>
278
+ </child>
279
+ <child groups='RO'>
280
+ <object class="GtkToolButton">
281
+ <property name="icon-name">go-home</property>
282
+ <property name="action-name">win.HomePerson</property>
283
+ <property name="tooltip_text" translatable="yes">'''
284
+ '''Go to the default person</property>
285
+ <property name="label" translatable="yes">_Home</property>
286
+ <property name="use-underline">True</property>
287
+ </object>
288
+ <packing>
289
+ <property name="homogeneous">False</property>
290
+ </packing>
291
+ </child>
292
+ </placeholder>
293
+ ''' ,
294
+ '''
295
+ <placeholder id='BarCommonEdit'>
296
+ <child groups='RO'>
297
+ <object class="GtkToolButton">
298
+ <property name="icon-name">document-print</property>
299
+ <property name="action-name">win.PrintView</property>
300
+ <property name="tooltip_text" translatable="yes">"Save the dot file '''
301
+ '''for a later print.\n This will save a .gv file and a svg file.\n '''
302
+ '''You must select a .gv file"</property>
303
+ <property name="label" translatable="yes">_Print...</property>
304
+ <property name="use-underline">True</property>
305
+ </object>
306
+ <packing>
307
+ <property name="homogeneous">False</property>
308
+ </packing>
309
+ </child>
310
+ </placeholder>
311
+ ''' ]
259
312
260
313
def navigation_type (self ):
261
314
"""
@@ -503,20 +556,19 @@ def animation_config_panel(self, configdialog):
503
556
# Printing functionalities
504
557
#
505
558
#-------------------------------------------------------------------------
506
- def printview (self , obj ):
559
+ def printview (self , * obj ):
507
560
"""
508
561
Save the dot file for a later printing with an appropriate tool.
509
562
"""
510
563
# ask for the dot file name
511
564
filter1 = Gtk .FileFilter ()
512
565
filter1 .set_name ("dot files" )
513
566
filter1 .add_pattern ("*.gv" )
514
- dot = Gtk .FileChooserDialog (
515
- _ ("Select a dot file name" ),
516
- action = Gtk .FileChooserAction .SAVE ,
517
- buttons = (_ ('_Cancel' ), Gtk .ResponseType .CANCEL ,
518
- _ ('_Apply' ), Gtk .ResponseType .OK ),
519
- parent = self .uistate .window )
567
+ dot = Gtk .FileChooserDialog (title = _ ("Select a dot file name" ),
568
+ action = Gtk .FileChooserAction .SAVE ,
569
+ transient_for = self .uistate .window )
570
+ dot .add_button (_ ('_Cancel' ), Gtk .ResponseType .CANCEL )
571
+ dot .add_button (_ ('_Apply' ), Gtk .ResponseType .OK )
520
572
mpath = config .get ('paths.report-directory' )
521
573
dot .set_current_folder (os .path .dirname (mpath ))
522
574
dot .set_filter (filter1 )
@@ -588,9 +640,11 @@ def __init__(self, view, dbstate, uistate):
588
640
589
641
scrolled_win .add (self .canvas )
590
642
591
- self .vbox = Gtk .Box (False , 4 , orientation = Gtk .Orientation .VERTICAL )
643
+ self .vbox = Gtk .Box (homogeneous = False , spacing = 4 ,
644
+ orientation = Gtk .Orientation .VERTICAL )
592
645
self .vbox .set_border_width (4 )
593
- hbox = Gtk .Box (False , 4 , orientation = Gtk .Orientation .HORIZONTAL )
646
+ hbox = Gtk .Box (homogeneous = False , spacing = 4 ,
647
+ orientation = Gtk .Orientation .HORIZONTAL )
594
648
self .vbox .pack_start (hbox , False , False , 0 )
595
649
596
650
# add zoom-in button
@@ -640,7 +694,7 @@ def __init__(self, view, dbstate, uistate):
640
694
641
695
# add spinners for quick generations change
642
696
box = Gtk .Box (orientation = Gtk .Orientation .HORIZONTAL )
643
- box .pack_start (Gtk .Label ('↑' ), False , False , 1 )
697
+ box .pack_start (Gtk .Label (label = '↑' ), False , False , 1 )
644
698
self .ancestors_spinner = Gtk .SpinButton .new_with_range (0 , 50 , 1 )
645
699
self .ancestors_spinner .set_tooltip_text (_ ('Ancestor generations' ))
646
700
self .ancestors_spinner .set_value (
@@ -649,7 +703,7 @@ def __init__(self, view, dbstate, uistate):
649
703
self .set_ancestors_generations )
650
704
box .pack_start (self .ancestors_spinner , False , False , 1 )
651
705
652
- box .pack_start (Gtk .Label ('↓' ), False , False , 1 )
706
+ box .pack_start (Gtk .Label (label = '↓' ), False , False , 1 )
653
707
self .descendants_spinner = Gtk .SpinButton .new_with_range (1 , 50 , 1 )
654
708
self .descendants_spinner .set_tooltip_text (_ ('Descendant generations' ))
655
709
self .descendants_spinner .set_value (
@@ -2574,6 +2628,7 @@ def get_person_label(self, person):
2574
2628
label = ""
2575
2629
line_delimiter = '\\ n'
2576
2630
2631
+
2577
2632
# If we have an image, then start an HTML table.
2578
2633
# Remember to close the table afterwards!
2579
2634
#
0 commit comments