RemoveUnused.py: convert to use gtkbuilder instead of libglade
svn: r12422
This commit is contained in:
parent
8e08149567
commit
39132b011a
@ -46,7 +46,6 @@ log = logging.getLogger(".RemoveUnused")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
from gtk import glade
|
||||
import gobject
|
||||
from gen.lib import StyledText
|
||||
|
||||
@ -133,18 +132,19 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
|
||||
base = os.path.dirname(__file__)
|
||||
self.glade_file = base + os.sep + "unused.glade"
|
||||
|
||||
self.top = glade.XML(self.glade_file,"unused","gramps")
|
||||
window = self.top.get_widget("unused")
|
||||
self.set_window(window,self.top.get_widget('title'),self.title)
|
||||
self.top = gtk.Builder()
|
||||
self.top.add_from_file(self.glade_file)
|
||||
window = self.top.get_object("unused")
|
||||
self.set_window(window,self.top.get_object('title'),self.title)
|
||||
|
||||
self.events_box = self.top.get_widget('events_box')
|
||||
self.sources_box = self.top.get_widget('sources_box')
|
||||
self.places_box = self.top.get_widget('places_box')
|
||||
self.media_box = self.top.get_widget('media_box')
|
||||
self.repos_box = self.top.get_widget('repos_box')
|
||||
self.notes_box = self.top.get_widget('notes_box')
|
||||
self.find_button = self.top.get_widget('find_button')
|
||||
self.remove_button = self.top.get_widget('remove_button')
|
||||
self.events_box = self.top.get_object('events_box')
|
||||
self.sources_box = self.top.get_object('sources_box')
|
||||
self.places_box = self.top.get_object('places_box')
|
||||
self.media_box = self.top.get_object('media_box')
|
||||
self.repos_box = self.top.get_object('repos_box')
|
||||
self.notes_box = self.top.get_object('notes_box')
|
||||
self.find_button = self.top.get_object('find_button')
|
||||
self.remove_button = self.top.get_object('remove_button')
|
||||
|
||||
self.events_box.set_active(self.options.handler.options_dict['events'])
|
||||
self.sources_box.set_active(
|
||||
@ -155,18 +155,18 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
|
||||
self.repos_box.set_active(self.options.handler.options_dict['repos'])
|
||||
self.notes_box.set_active(self.options.handler.options_dict['notes'])
|
||||
|
||||
self.warn_tree = self.top.get_widget('warn_tree')
|
||||
self.warn_tree = self.top.get_object('warn_tree')
|
||||
self.warn_tree.connect('button_press_event', self.double_click)
|
||||
|
||||
self.selection = self.warn_tree.get_selection()
|
||||
|
||||
self.mark_button = self.top.get_widget('mark_button')
|
||||
self.mark_button = self.top.get_object('mark_button')
|
||||
self.mark_button.connect('clicked',self.mark_clicked)
|
||||
|
||||
self.unmark_button = self.top.get_widget('unmark_button')
|
||||
self.unmark_button = self.top.get_object('unmark_button')
|
||||
self.unmark_button.connect('clicked',self.unmark_clicked)
|
||||
|
||||
self.invert_button = self.top.get_widget('invert_button')
|
||||
self.invert_button = self.top.get_object('invert_button')
|
||||
self.invert_button.connect('clicked',self.invert_clicked)
|
||||
|
||||
self.real_model = gtk.ListStore(gobject.TYPE_BOOLEAN,
|
||||
@ -205,13 +205,13 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
|
||||
name_column.set_sort_column_id(RemoveUnused.OBJ_NAME_COL)
|
||||
self.warn_tree.append_column(name_column)
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
self.top.connect_signals({
|
||||
"destroy_passed_object" : self.close,
|
||||
"on_remove_button_clicked": self.do_remove,
|
||||
"on_find_button_clicked" : self.find,
|
||||
})
|
||||
|
||||
self.dc_label = self.top.get_widget('dc_label')
|
||||
self.dc_label = self.top.get_object('dc_label')
|
||||
|
||||
self.sensitive_list = [self.warn_tree,self.mark_button,
|
||||
self.unmark_button,self.invert_button,
|
||||
@ -276,13 +276,13 @@ class RemoveUnused(Tool.Tool,ManagedWindow.ManagedWindow,UpdateCallback):
|
||||
'total_func' : self.db.get_number_of_notes},
|
||||
}
|
||||
|
||||
for the_type in tables.keys():
|
||||
for the_type, the_func in tables.iteritems():
|
||||
if not self.options.handler.options_dict[the_type]:
|
||||
# This table was not requested. Skip it.
|
||||
continue
|
||||
|
||||
cursor = tables[the_type]['cursor_func']()
|
||||
total = tables[the_type]['total_func']()
|
||||
cursor = the_func['cursor_func']()
|
||||
total = the_func['total_func']()
|
||||
self.set_total(total)
|
||||
item = cursor.first()
|
||||
while item:
|
||||
|
@ -1,26 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<?xml version="1.0"?>
|
||||
<!--*- mode: xml -*-->
|
||||
<glade-interface>
|
||||
<widget class="GtkDialog" id="unused">
|
||||
<interface>
|
||||
<object class="GtkDialog" id="unused">
|
||||
<property name="visible">True</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="default_height">300</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<signal name="delete_event" handler="on_result_delete_event"/>
|
||||
<signal handler="on_result_delete_event" name="delete_event"/>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox2">
|
||||
<object class="GtkVBox" id="dialog-vbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox5">
|
||||
<object class="GtkVBox" id="vbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">6</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="title">
|
||||
<object class="GtkLabel" id="title">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@ -28,113 +27,106 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<object class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkVButtonBox" id="vbuttonbox1">
|
||||
<object class="GtkVButtonBox" id="vbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="events_box">
|
||||
<object class="GtkCheckButton" id="events_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for events</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="sources_box">
|
||||
<object class="GtkCheckButton" id="sources_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for sources</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="places_box">
|
||||
<object class="GtkCheckButton" id="places_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for places</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="media_box">
|
||||
<object class="GtkCheckButton" id="media_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for media</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="repos_box">
|
||||
<object class="GtkCheckButton" id="repos_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for repositories</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="notes_box">
|
||||
<object class="GtkCheckButton" id="notes_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Search for notes</property>
|
||||
<property name="response_id">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<object class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="find_button">
|
||||
<object class="GtkButton" id="find_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label">gtk-find</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="on_find_button_clicked"/>
|
||||
</widget>
|
||||
<signal handler="on_find_button_clicked" name="clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@ -142,67 +134,64 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow4">
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="warn_tree">
|
||||
<object class="GtkTreeView" id="warn_tree">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="rules_hint">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<object class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="mark_button">
|
||||
<object class="GtkButton" id="mark_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label" translatable="yes">_Mark all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="unmark_button">
|
||||
<object class="GtkButton" id="unmark_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label" translatable="yes">_Unmark all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="invert_button">
|
||||
<object class="GtkButton" id="invert_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label" translatable="yes">In_vert marks</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="response_id">0</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
@ -210,59 +199,71 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dc_label">
|
||||
<object class="GtkLabel" id="dc_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Double-click on a row to view/edit data</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area2">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<widget class="GtkButton" id="remove_button">
|
||||
<object class="GtkButton" id="remove_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">-3</property>
|
||||
<signal name="clicked" handler="on_remove_button_clicked"/>
|
||||
</widget>
|
||||
<signal handler="on_remove_button_clicked" name="clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="closebutton1">
|
||||
<object class="GtkButton" id="closebutton1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="response_id">-7</property>
|
||||
<signal name="clicked" handler="destroy_passed_object"/>
|
||||
</widget>
|
||||
<signal handler="destroy_passed_object" name="clicked"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</object>
|
||||
</child>
|
||||
</widget>
|
||||
</glade-interface>
|
||||
<action-widgets>
|
||||
<action-widget response="0">events_box</action-widget>
|
||||
<action-widget response="0">sources_box</action-widget>
|
||||
<action-widget response="0">places_box</action-widget>
|
||||
<action-widget response="0">media_box</action-widget>
|
||||
<action-widget response="0">repos_box</action-widget>
|
||||
<action-widget response="0">notes_box</action-widget>
|
||||
<action-widget response="0">find_button</action-widget>
|
||||
<action-widget response="0">mark_button</action-widget>
|
||||
<action-widget response="0">unmark_button</action-widget>
|
||||
<action-widget response="0">invert_button</action-widget>
|
||||
<action-widget response="-3">remove_button</action-widget>
|
||||
<action-widget response="-7">closebutton1</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</interface>
|
||||
|
Loading…
Reference in New Issue
Block a user