diff --git a/ChangeLog b/ChangeLog index 98c952f4f..5238c38ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-11-27 Benny Malengier + * src/ManagedWindow.py: new call_modal method. + Reports tools should use that + * src/GrampsWidgets.py: improve a text string + * src/plugins/NarrativeWeb.py: use call_modal, trunkate long filter + names, better placement of selector note/media + * src/ReportBase/_BareReportDialog.py: reports are modal but not + transient, remove bug to make them transient! + 2007-11-26 Benny Malengier * src/plugins/NarrativeWeb.py: new select contact-header-footer-intro * src/GrampsWidgets.py: widget for new select diff --git a/src/GrampsWidgets.py b/src/GrampsWidgets.py index d3db32cf9..873113a41 100644 --- a/src/GrampsWidgets.py +++ b/src/GrampsWidgets.py @@ -799,7 +799,10 @@ class ObjEntry: self.share.connect('clicked', self.share_clicked) if not self.db.readonly and not name: - self.label.set_text(self.EMPTY_TEXT) + if self.add_edt is None: + self.label.set_text(self.EMPTY_TEXT_RED) + else: + self.label.set_text(self.EMPTY_TEXT) self.label.set_use_markup(True) else: self.label.set_text(name) @@ -918,6 +921,7 @@ class PlaceEntry(ObjEntry): """ EMPTY_TEXT = "%s" % _('To select a place, use drag-and-drop ' 'or use the buttons') + EMPTY_TEXT_RED = "%s" % _('No place given, click button to select one') EDIT_STR = _('Edit place') SHARE_STR = _('Select an existing place') ADD_STR = _('Add a new place') @@ -971,6 +975,7 @@ class MediaEntry(ObjEntry): """ EMPTY_TEXT = "%s" % _('To select a media object, use drag-and-drop ' 'or use the buttons') + EMPTY_TEXT_RED = "%s" % _('No image given, click button to select one') EDIT_STR = _('Edit media object') SHARE_STR = _('Select an existing media object') ADD_STR = _('Add a new media object') @@ -1024,6 +1029,7 @@ class NoteEntry(ObjEntry): """ EMPTY_TEXT = "%s" % _('To select a note, use drag-and-drop ' 'or use the buttons') + EMPTY_TEXT_RED = "%s" % _('No note given, click button to select one') EDIT_STR = _('Edit Note') SHARE_STR = _('Select an existing note') ADD_STR = _('Add a new note') diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index c2fa385d6..4cacd9c0a 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -418,6 +418,36 @@ class ManagedWindow: self.opened = True self.window.show_all() + def modal_call(self, after_ok_func=None): + ''' + Method to do modal run of the ManagedWindow. + Connect the OK button to a method that checks if all is ok, + Do not call close, close is called here. + (if not ok, do self.window.run() to obtain new response ) + TODO: remove close here and do close in BareReportDialog, + this can only be done, once all methods use modal_call() + instead of their own implementation + Connect Cancel to do close, delete event is connected to close + here in ManagedWindow. + Do not generete RESPONSE_OK/CANCEL/DELETE_EVENT on button clicks + of other buttons + after_ok_func is called on ok click in this method + ''' + #self.show() + while True: + response = self.window.run() + if response == gtk.RESPONSE_OK: + # dialog will be close by connect, now continue work while + # rest of dialog is unresponsive, release when finished + self.close() + if after_ok_func is not None: + after_ok_func() + break + elif (response == gtk.RESPONSE_DELETE_EVENT or + response == gtk.RESPONSE_CANCEL): + # connect buttons generating this to a close call + break + def close(self, *obj): """ Close itself. diff --git a/src/ReportBase/_BareReportDialog.py b/src/ReportBase/_BareReportDialog.py index 30a4ba733..c375505de 100644 --- a/src/ReportBase/_BareReportDialog.py +++ b/src/ReportBase/_BareReportDialog.py @@ -158,7 +158,8 @@ class BareReportDialog(ManagedWindow.ManagedWindow): self.setup_report_options_frame() self.setup_other_frames() self.notebook.set_current_page(0) - self.window.show_all() + self.show() + #self.window.show_all() def get_title(self): """The window title for this dialog""" diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py index 1efb5f1bd..be658cb83 100644 --- a/src/plugins/NarrativeWeb.py +++ b/src/plugins/NarrativeWeb.py @@ -2724,7 +2724,11 @@ class WebReportOptions(ReportOptions): include_single=False) self.filter_menu = gtk.combo_box_new_text() for filter in filter_list: - self.filter_menu.append_text(filter.get_name()) + #cut name filter so as not to make dialog too large + if len(filter.get_name()) > 60: + self.filter_menu.append_text(filter.get_name()[:60]+'...') + else: + self.filter_menu.append_text(filter.get_name()) if filter_index > len(filter_list): filter_index = 0 self.filter_menu.set_active(filter_index) @@ -3069,16 +3073,7 @@ class WebReportDialog(ReportDialog): name, translated_name) self.style_name = None - while True: - response = self.window.run() - if response == gtk.RESPONSE_OK: - self.close() - self.make_report() - break - elif (response == gtk.RESPONSE_DELETE_EVENT or - response == gtk.RESPONSE_CANCEL): - # the buttons generating this already call close via connect - break + self.modal_call(self.make_report) def on_cancel(self, *obj): self.close(*obj) @@ -3277,8 +3272,11 @@ def mk_object_entry(): ''' box = gtk.HBox() label = gtk.Label() + label.set_justify(gtk.JUSTIFY_LEFT) + labelexpand = gtk.Label() button_sel = gtk.Button() - box.pack_start(label) + box.pack_start(label, expand=False, fill=True) + box.pack_start(labelexpand, expand=True, fill=True) box.pack_start(button_sel, expand=False, fill=False) return (box, label, button_sel)