diff --git a/src/DisplayState.py b/src/DisplayState.py index 85500cad2..c30c52c18 100644 --- a/src/DisplayState.py +++ b/src/DisplayState.py @@ -402,15 +402,17 @@ class DisplayState(gen.utils.Callback): # but this connection is still made! # self.dbstate.connect('database-changed', self.db_changed) - self.__netbook_mode = False - if self.window.get_screen().get_width() <= 1024: - self.__netbook_mode = True + def screen_width(self): + """ + Return the width of the current screen. + """ + return self.window.get_screen().get_width() - def netbook_mode(self): + def screen_height(self): """ - Return True if running on a small screen, else return False. + Return the height of the current screen. """ - return self.__netbook_mode + return self.window.get_screen().get_height() def clear_history(self): """ diff --git a/src/gui/grampsbar.py b/src/gui/grampsbar.py index 550e589df..1c2a9c1b7 100644 --- a/src/gui/grampsbar.py +++ b/src/gui/grampsbar.py @@ -314,10 +314,9 @@ class GrampsBar(gtk.Notebook): """ Add a tab to the notebook for the given gramplet. """ - if self.uistate.netbook_mode(): - gramplet.set_size_request(225, 120) - else: - gramplet.set_size_request(285, 200) + width = int(self.uistate.screen_width() * 0.25) + height = int(self.uistate.screen_height() * 0.20) + gramplet.set_size_request(width, height) page_num = self.append_page(gramplet) return page_num diff --git a/src/gui/widgets/photo.py b/src/gui/widgets/photo.py index cd873ec0c..4d27267df 100644 --- a/src/gui/widgets/photo.py +++ b/src/gui/widgets/photo.py @@ -44,7 +44,7 @@ class Photo(gtk.EventBox): """ Displays an image and allows it to be viewed in an external image viewer. """ - def __init__(self, netbook_mode=False): + def __init__(self, use_small_size=False): gtk.EventBox.__init__(self) self.full_path = None self.photo = gtk.Image() @@ -54,7 +54,7 @@ class Photo(gtk.EventBox): 'viewer application.') self.set_tooltip_text(tip) self.__size = ThumbNails.SIZE_LARGE - if netbook_mode: + if use_small_size: self.__size = ThumbNails.SIZE_NORMAL def set_image(self, full_path, mime_type=None, rectangle=None): diff --git a/src/plugins/gramplet/CalendarGramplet.py b/src/plugins/gramplet/CalendarGramplet.py index 59318e02b..73586a5b3 100644 --- a/src/plugins/gramplet/CalendarGramplet.py +++ b/src/plugins/gramplet/CalendarGramplet.py @@ -39,7 +39,7 @@ class CalendarGramplet(Gramplet): self.set_tooltip(_("Double-click a day for details")) self.gui.calendar = gtk.Calendar() self.gui.calendar.connect('day-selected-double-click', self.double_click) - if self.uistate.netbook_mode(): + if self.uistate.screen_width() <= 1024: self.gui.calendar.set_display_options(gtk.CALENDAR_SHOW_HEADING) self.gui.get_container_widget().remove(self.gui.textview) self.gui.get_container_widget().add_with_viewport(self.gui.calendar) diff --git a/src/plugins/gramplet/Gallery.py b/src/plugins/gramplet/Gallery.py index 01fa9c6a7..6d6886a0f 100644 --- a/src/plugins/gramplet/Gallery.py +++ b/src/plugins/gramplet/Gallery.py @@ -61,7 +61,7 @@ class Gallery(Gramplet): full_path = Utils.media_path_full(self.dbstate.db, media.get_path()) mime_type = media.get_mime_type() if mime_type and mime_type.startswith("image"): - photo = Photo(self.uistate.netbook_mode()) + photo = Photo(self.uistate.screen_height() < 1000) photo.set_image(full_path, mime_type, media_ref.get_rectangle()) self.image_list.append(photo) self.top.pack_start(photo, expand=False, fill=False) diff --git a/src/plugins/gramplet/MediaPreview.py b/src/plugins/gramplet/MediaPreview.py index 9b15ec6ea..50a4114ba 100644 --- a/src/plugins/gramplet/MediaPreview.py +++ b/src/plugins/gramplet/MediaPreview.py @@ -38,7 +38,7 @@ class MediaPreview(Gramplet): Build the GUI interface. """ self.top = gtk.HBox() - self.photo = Photo(self.uistate.netbook_mode()) + self.photo = Photo(self.uistate.screen_height() < 1000) self.top.pack_start(self.photo, fill=True, expand=False, padding=5) self.top.show_all() return self.top diff --git a/src/plugins/gramplet/PersonDetails.py b/src/plugins/gramplet/PersonDetails.py index 42e7befae..4975fe1c7 100644 --- a/src/plugins/gramplet/PersonDetails.py +++ b/src/plugins/gramplet/PersonDetails.py @@ -45,7 +45,7 @@ class PersonDetails(Gramplet): """ self.top = gtk.HBox() vbox = gtk.VBox() - self.photo = Photo(self.uistate.netbook_mode()) + self.photo = Photo(self.uistate.screen_height() < 1000) self.photo.show() self.name = gtk.Label() self.name.set_alignment(0, 0) diff --git a/src/plugins/gramplet/PlaceDetails.py b/src/plugins/gramplet/PlaceDetails.py index 8d61a63f2..21fee3e19 100644 --- a/src/plugins/gramplet/PlaceDetails.py +++ b/src/plugins/gramplet/PlaceDetails.py @@ -42,7 +42,7 @@ class PlaceDetails(Gramplet): """ self.top = gtk.HBox() vbox = gtk.VBox() - self.photo = Photo(self.uistate.netbook_mode()) + self.photo = Photo(self.uistate.screen_height() < 1000) self.title = gtk.Label() self.title.set_alignment(0, 0) self.title.modify_font(pango.FontDescription('sans bold 12'))