diff --git a/src/gui/autocomp.py b/src/gui/autocomp.py index cfc47fc0c..cb93f6ca8 100644 --- a/src/gui/autocomp.py +++ b/src/gui/autocomp.py @@ -139,17 +139,15 @@ class StandardCustomSelector(object): # create combo box entry if cbe: + assert cbe.get_has_entry() self.selector = cbe - self.selector.set_model(self.store) - renderer = Gtk.CellRendererText() - self.selector.pack_start(renderer, True) - self.selector.add_attribute(renderer, 'text', 1) else: self.selector = Gtk.ComboBox(has_entry=True) - self.selector.set_model(self.store) - renderer = Gtk.CellRendererText() - self.selector.pack_start(renderer, True) - self.selector.add_attribute(renderer, 'text', 1) + self.selector.set_model(self.store) + self.selector.set_entry_text_column(1) + #renderer = Gtk.CellRendererText() + #self.selector.pack_start(renderer, True) + #self.selector.add_attribute(renderer, 'text', 1) if self.active_key is not None: self.selector.set_active(self.active_index) diff --git a/src/gui/glade/editattribute.glade b/src/gui/glade/editattribute.glade index 0b4c31270..b69c8ea56 100644 --- a/src/gui/glade/editattribute.glade +++ b/src/gui/glade/editattribute.glade @@ -106,7 +106,8 @@ Note: several predefined attributes refer to values present in the GEDCOM standa True - False + True + True diff --git a/src/gui/glade/editchildref.glade b/src/gui/glade/editchildref.glade index 36d9c1101..7639302e2 100644 --- a/src/gui/glade/editchildref.glade +++ b/src/gui/glade/editchildref.glade @@ -42,7 +42,8 @@ True - False + True + True diff --git a/src/gui/glade/editdate.glade b/src/gui/glade/editdate.glade index 3f83591e9..b70282496 100644 --- a/src/gui/glade/editdate.glade +++ b/src/gui/glade/editdate.glade @@ -1,8 +1,6 @@ - - - + 31 1 @@ -25,23 +23,100 @@ 1 10 + + + + + + + False dialog - + True + False + vertical + + + True + False + end + + + gtk-help + False + True + True + True + False + False + True + + + False + False + 0 + + + + + gtk-cancel + False + True + True + True + False + False + True + + + False + False + 1 + + + + + gtk-ok + False + True + True + True + False + False + True + + + False + False + 2 + + + + + False + True + end + 0 + + True + False True + False True + False True + False 0 Calenda_r: True @@ -49,6 +124,7 @@ False + True 6 0 @@ -56,6 +132,7 @@ True + False calendar_model @@ -65,6 +142,8 @@ + True + True 6 1 @@ -72,6 +151,7 @@ False + True 6 0 @@ -79,9 +159,11 @@ True + False True + False False @@ -93,11 +175,14 @@ Dua_l dated + False True True False Old Style/New Style + False True + 0.5 True @@ -109,6 +194,7 @@ True + False 1 Ne_w year begins: True @@ -116,6 +202,8 @@ newyear + True + True 2 @@ -126,11 +214,15 @@ + True + True 3 + True + True 6 1 @@ -138,13 +230,33 @@ True + False 5 8 6 6 + + + + + + + + + + + + + + + + + + True + False 0 6 <b>Q_uality</b> @@ -161,7 +273,7 @@ True - quality_model + False @@ -183,6 +295,7 @@ True + False 0 6 <b>_Type</b> @@ -200,7 +313,7 @@ True - type_model + False @@ -222,6 +335,7 @@ True + False 0 6 <b>Date</b> @@ -238,6 +352,7 @@ True + False _Day True start_day @@ -254,6 +369,7 @@ True + False _Month True start_month_box @@ -270,6 +386,7 @@ True + False _Year True start_year @@ -303,7 +420,7 @@ True - month_model1 + False @@ -340,6 +457,7 @@ True + False 0 6 <b>Second date</b> @@ -357,6 +475,7 @@ True + False D_ay True stop_day @@ -373,6 +492,7 @@ True + False Mo_nth True stop_month_box @@ -389,6 +509,7 @@ True + False Y_ear True stop_year @@ -422,7 +543,7 @@ True - month_model2 + False @@ -456,24 +577,6 @@ 6 - - - - - - - - - - - - - - - - - - False @@ -485,9 +588,11 @@ True + False True + False Te_xt comment: True date_text_entry @@ -505,79 +610,31 @@ True + True + True 6 1 + True + True 3 + True + True 0 - - 1 - - - - - True - end - - - gtk-help - True - True - True - False - True - - - False - False - 0 - - - - - gtk-cancel - True - True - True - False - True - - - False - False - 1 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 2 - - - False - end - 0 + False + 1 @@ -588,9 +645,15 @@ button176 - + - + + + + + + + @@ -606,16 +669,4 @@ - - - - - - - - - - - - diff --git a/src/gui/glade/editevent.glade b/src/gui/glade/editevent.glade index ae5653529..a2159849e 100644 --- a/src/gui/glade/editevent.glade +++ b/src/gui/glade/editevent.glade @@ -1,26 +1,105 @@ - - + + False dialog - + True + False + vertical + + + True + False + end + + + gtk-cancel + False + True + True + True + True + True + True + Close window without changes + Close window without changes + False + True + + + False + False + 0 + + + + + gtk-ok + False + True + True + True + True + True + Accept changes and close window + Accept changes and close window + False + True + + + False + False + 1 + + + + + gtk-help + False + True + True + True + True + False + True + + + False + False + 2 + + + + + False + True + end + 0 + + True + False True + False 12 4 5 12 4 + + + True + False 0 _Event type: True @@ -35,6 +114,7 @@ True + False 0 _Date: True @@ -50,11 +130,13 @@ + False True True True True Invoke date editor + False none @@ -68,6 +150,7 @@ True + False True Show Date Editor gramps-date @@ -89,6 +172,7 @@ True + False 0 De_scription: True @@ -104,9 +188,11 @@ + False True True True + False none @@ -117,6 +203,7 @@ True + False gtk-dialog-authentication @@ -153,6 +240,7 @@ True + False 0 3 _Place: @@ -169,14 +257,17 @@ + False True True True + False none True + False @@ -192,21 +283,27 @@ True + False True + False 0 end + True + True 0 + False True True True + False none @@ -220,6 +317,7 @@ True + False gtk-index @@ -248,13 +346,15 @@ True + False What type of event this is. Eg 'Burial', 'Graduation', ... . - True - - - False - - + True + + + True + True + + 1 @@ -266,6 +366,7 @@ True + False 0 _ID: True @@ -304,11 +405,9 @@ 3 4 + - - - False @@ -318,72 +417,11 @@ + True + True 1 - - - True - end - - - gtk-cancel - True - True - True - True - True - True - Close window without changes - Close window without changes - True - - - False - False - 0 - - - - - gtk-ok - True - True - True - True - True - Accept changes and close window - Accept changes and close window - True - - - False - False - 1 - - - - - gtk-help - True - True - True - True - True - - - False - False - 2 - - - - - False - end - 0 - - diff --git a/src/gui/glade/editeventref.glade b/src/gui/glade/editeventref.glade index 4f84783ea..2df9feb0c 100644 --- a/src/gui/glade/editeventref.glade +++ b/src/gui/glade/editeventref.glade @@ -91,7 +91,8 @@ True - False + True + True @@ -354,7 +355,8 @@ True - False + True + True diff --git a/src/gui/glade/editfamily.glade b/src/gui/glade/editfamily.glade index fffef8f00..82c4ac952 100644 --- a/src/gui/glade/editfamily.glade +++ b/src/gui/glade/editfamily.glade @@ -636,7 +636,8 @@ True - False + True + True diff --git a/src/gui/glade/editname.glade b/src/gui/glade/editname.glade index ccffc1970..bdeeec631 100644 --- a/src/gui/glade/editname.glade +++ b/src/gui/glade/editname.glade @@ -42,7 +42,8 @@ True - False + True + True diff --git a/src/gui/glade/editnote.glade b/src/gui/glade/editnote.glade index a4ce4ad3a..d87a437b0 100644 --- a/src/gui/glade/editnote.glade +++ b/src/gui/glade/editnote.glade @@ -82,7 +82,8 @@ True - False + True + True diff --git a/src/gui/glade/editperson.glade b/src/gui/glade/editperson.glade index eb5e6ab90..0e08f77ba 100644 --- a/src/gui/glade/editperson.glade +++ b/src/gui/glade/editperson.glade @@ -345,7 +345,8 @@ True - False + True + True @@ -644,7 +645,8 @@ Indicate that the surname consists of different parts. Every surname has its own True - False + True + True diff --git a/src/gui/glade/editreporef.glade b/src/gui/glade/editreporef.glade index 96be6792d..8a9b370a5 100644 --- a/src/gui/glade/editreporef.glade +++ b/src/gui/glade/editreporef.glade @@ -79,7 +79,8 @@ True - False + True + True @@ -333,7 +334,8 @@ True - False + True + True diff --git a/src/gui/glade/editrepository.glade b/src/gui/glade/editrepository.glade index 2a6ae0682..f3b86a5a5 100644 --- a/src/gui/glade/editrepository.glade +++ b/src/gui/glade/editrepository.glade @@ -74,7 +74,8 @@ True - False + True + True diff --git a/src/gui/glade/editurl.glade b/src/gui/glade/editurl.glade index 312c354e2..f2e5f97a6 100644 --- a/src/gui/glade/editurl.glade +++ b/src/gui/glade/editurl.glade @@ -103,7 +103,8 @@ True - False + True + True diff --git a/src/gui/views/treemodels/flatbasemodel.py b/src/gui/views/treemodels/flatbasemodel.py index 4fe3eda43..1fe6fcbd4 100644 --- a/src/gui/views/treemodels/flatbasemodel.py +++ b/src/gui/views/treemodels/flatbasemodel.py @@ -364,7 +364,7 @@ class FlatNodeMap(object): :param srtkey_hndl: the (sortkey, handle) tuple that must be inserted :Returns: path of the row inserted in the treeview - :Returns type: integer or None + :Returns type: Gtk.TreePath or None """ if srtkey_hndl[1] in self._hndl2index: print ('WARNING: Attempt to add row twice to the model (%s)' % @@ -385,7 +385,7 @@ class FlatNodeMap(object): #update self.__corr so it remains correct if self._reverse: self.__corr = (len(self._index2hndl) - 1, -1) - return self.real_path(insert_pos) + return Gtk.TreePath((self.real_path(insert_pos),)) def delete(self, srtkey_hndl): """ @@ -398,7 +398,7 @@ class FlatNodeMap(object): :param srtkey_hndl: the (sortkey, handle) tuple that must be inserted :Returns: path of the row deleted from the treeview - :Returns type: integer or None + :Returns type: Gtk.TreePath or None """ #remove it from the full list first if not self._identical: @@ -425,7 +425,7 @@ class FlatNodeMap(object): for key, val in self._hndl2index.iteritems(): if val > index: self._hndl2index[key] -= 1 - return delpath + return Gtk.TreePath((delpath,)) #------------------------------------------------------------------------- # @@ -647,7 +647,7 @@ class FlatBaseModel(GObject.Object, Gtk.TreeModel): insert_path = self.node_map.insert(insert_val) if insert_path is not None: - node = self.get_iter(insert_path) + node = self.do_get_iter(insert_path) self.row_inserted(insert_path, node) else: self.node_map.insert(insert_val, allkeyonly=True) @@ -683,7 +683,7 @@ class FlatBaseModel(GObject.Object, Gtk.TreeModel): else: #the row is visible in the view, is changed, but the order is fixed path = self.node_map.get_path_from_handle(handle) - node = self.get_iter(path) + node = self.do_get_iter(path)[1] self.row_changed(path, node) def handle2path(self, handle): diff --git a/src/gui/widgets/monitoredwidgets.py b/src/gui/widgets/monitoredwidgets.py index db93d358c..6445208b6 100644 --- a/src/gui/widgets/monitoredwidgets.py +++ b/src/gui/widgets/monitoredwidgets.py @@ -421,8 +421,8 @@ class MonitoredDataType(object): """ Constructor for the MonitoredDataType class. - @param obj: Existing ComboBoxEntry widget to use. - @type obj: Gtk.ComboBoxEntry + @param obj: Existing ComboBox widget to use with has_entry=True. + @type obj: Gtk.ComboBox @param set_val: The function that sets value of the type in the object @type set_val: method @param get_val: The function that gets value of the type in the object. diff --git a/src/gui/widgets/validatedmaskedentry.py b/src/gui/widgets/validatedmaskedentry.py index a3563f123..30378c77d 100644 --- a/src/gui/widgets/validatedmaskedentry.py +++ b/src/gui/widgets/validatedmaskedentry.py @@ -198,15 +198,20 @@ class Tooltip(Gtk.Window): def _calculate_pos(self, widget): screen = widget.get_screen() - w, h = self.size_request() + greq = Gtk.Requisition() + greq = self.size_request() + w = greq.width + h = greq.height - x, y = widget.window.get_origin() + _, x, y = widget.get_window().get_origin() - if widget.flags() & Gtk.NO_WINDOW: - x += widget.allocation.x - y += widget.allocation.y + # TODO GTK3 No longer WidgetFlags! + #if widget.get_state_flags() & Gtk.WidgetFlags.NO_WINDOW: + x += widget.get_allocation().width + y += widget.get_allocation().height - x = screen.get_root_window().get_pointer()[0] + x = screen.get_root_window().get_pointer()[1] + #TODO GTK3, how: x = screen.get_window().get_device_position()[0] x -= (w / 2 + Tooltip.BORDER_WIDTH) pointer_screen, px, py, _ = screen.get_display().get_pointer() @@ -222,21 +227,26 @@ class Tooltip(Gtk.Window): elif x < monitor.x: x = monitor.x - if ((y + h + widget.allocation.height + Tooltip.BORDER_WIDTH) > + if ((y + h + widget.get_allocation().height + Tooltip.BORDER_WIDTH) > monitor.y + monitor.height): y -= h + Tooltip.BORDER_WIDTH else: - y += widget.allocation.height + Tooltip.BORDER_WIDTH + y += widget.get_allocation().height + Tooltip.BORDER_WIDTH return x, y # from gtktooltips.c:gtk_tooltips_paint_window def _on__draw_event(self, window, cairo_context): - w, h = window.size_request() - window.get_style().paint_flat_box(window.window, - Gtk.StateType.NORMAL, Gtk.ShadowType.OUT, - None, window, "tooltip", - 0, 0, w, h) + #GTK3 TODO, paint_flat_box deprecated !! + greq = self.size_request() + w = greq.width + h = greq.height + Gtk.render_frame(window.get_style_context(), cairo_context, + 0,0,w,h) + #window.get_style().paint_flat_box(window.window, + # Gtk.StateType.NORMAL, Gtk.ShadowType.OUT, + # None, window, "tooltip", + # 0, 0, w, h) return False def _real_display(self, widget): @@ -374,8 +384,8 @@ class IconEntry(object): if not isinstance(pixbuf, GdkPixbuf.Pixbuf): raise TypeError("pixbuf must be a GdkPixbuf") else: - # Turning of the icon should also restore the background - entry.modify_base(Gtk.StateType.NORMAL, None) + # Turning off the icon should also restore the background + entry.override_background_color(Gtk.StateType.NORMAL, None) if not self._pixbuf: return self._pixbuf = pixbuf @@ -412,7 +422,7 @@ class IconEntry(object): entry.realize() # Hack: Save a reference to the text area, now when its created - self._text_area = entry.get_root_window().get_children()[0] + self._text_area = entry.get_window().get_children()[0] self._text_area_pos = self._text_area.get_position() # PyGTK should allow default values for most of the values here. @@ -441,7 +451,8 @@ class IconEntry(object): Gdk.WindowAttributesType.VISUAL | Gdk.WindowAttributesType.NOREDIR ) - win = Gdk.Window(entry.get_root_window(), + #the window containing the icon image + win = Gdk.Window(entry.get_window(), attr, attrmask) ## Gdk.WindowType.CHILD, @@ -459,17 +470,15 @@ class IconEntry(object): ## wmclass_class='', override_redirect=True) self._icon_win = win win.set_user_data(entry) - win.set_background(entry.get_style().base[entry.get_state()]) + #win.set_background(entry.get_style().base[entry.get_state()]) self._constructed = True def deconstruct(self): if self._icon_win: - # This is broken on PyGTK 2.6.x - try: - self._icon_win.set_user_data(None) - except: - pass + self._icon_win.set_user_data(None) # Destroy not needed, called by the GC. + # TODO GTK3: we see error: Gdk-WARNING **: losing last reference to undestroyed window + # TODO Investigate self._icon_win = None def update_background(self, color): @@ -478,12 +487,27 @@ class IconEntry(object): if not self._icon_win: return - self._entry.modify_base(Gtk.StateType.NORMAL, color) + maxvalcol = 65535. + if color: + red = int(color.red/ maxvalcol*255) + green = int(color.green/ maxvalcol*255) + blue = int(color.blue/ maxvalcol*255) + rgba = Gdk.RGBA() + Gdk.RGBA.parse(rgba, 'rgb(%f,%f,%f)'%(red, green, blue)) + self._entry.override_background_color(Gtk.StateType.NORMAL, rgba) + else: + self._entry.override_background_color(Gtk.StateType.NORMAL, None) self.draw_pixbuf() def get_background(self): - return self._entry.get_style().base[Gtk.StateType.NORMAL] + """ Return default background color as a Gdk.Color """ + backcol = self._entry.get_style_context().get_background_color(Gtk.StateType.NORMAL) + bcol= Gdk.Color.parse('#fff')[1] + bcol.red = int(backcol.red * 65535) + bcol.green = int(backcol.green * 65535) + bcol.blue = int(backcol.blue * 65535) + return bcol def resize_windows(self): if not self._pixbuf: @@ -492,11 +516,15 @@ class IconEntry(object): icony = iconx = 4 # Make space for the icon, both windows - winw = self._entry.get_root_window().get_width() - textw = self._text_area.get_width() - texth = self._text_area.get_height() - #textw, texth = self._text_area.get_size() - textw = winw - self._pixw - (iconx + icony) + # GTK 3 gives for entry the sizes for the entire editor + geom =self._text_area.get_geometry() + origx = geom[0] + origy = geom[1] + origw = geom[2] + origh = geom[3] + textw = origw + texth = origh + textw = textw - self._pixw - (iconx + icony) if self._pos == Gtk.PositionType.LEFT: textx, texty = self._text_area_pos @@ -519,9 +547,10 @@ class IconEntry(object): # If the size of the window is large enough, resize and move it # Otherwise just move it to the right side of the entry if (icon_win.get_width(), icon_win.get_height()) != (self._pixw, self._pixh): - icon_win.move_resize(iconx, icony, self._pixw, self._pixh) + icon_win.move_resize(origx + origw - self._pixw, icony + origy, 100, 100) + icon_win.move_resize(origx + origw - self._pixw, icony + origy, self._pixw, self._pixh) else: - icon_win.move(iconx, icony) + icon_win.move(origx + origw - self._pixw, icony + origy) def draw_pixbuf(self): if not self._pixbuf: @@ -533,15 +562,21 @@ class IconEntry(object): return # Draw background first - color = self._entry.get_style().base_gc[self._entry.get_state()] - win.draw_rectangle(color, True, - 0, 0, self._pixw, self._pixh) + color = self._entry.get_style_context().get_background_color( + self._entry.get_state()) + ## TODO GTK3 no more draw_rectangle + cairo_t = Gdk.cairo_create(win) + Gdk.cairo_set_source_rgba(cairo_t, color) + #win.draw_rectangle(color, True, + # 0, 0, self._pixw, self._pixh) # If sensitive draw the icon, regardless of the window emitting the # event since makes it a bit smoother on resize - if self._entry.flags() & Gtk.SENSITIVE: - win.draw_pixbuf(None, self._pixbuf, 0, 0, 0, 0, - self._pixw, self._pixh) + if self._entry.get_sensitive(): + Gdk.cairo_set_source_pixbuf(cairo_t, self._pixbuf, 0, 0) + #TODO GTK3: win not visible under red/white part of gtkEntry, no icon also! + #TODO GTK3: deprecate the icon? Use button indication on edit date button? + win.show() def _update_position(self): if self._entry.get_property('xalign') > 0.5: @@ -649,6 +684,7 @@ class MaskedEntry(UndoableEntry): self._block_insert = False self._block_delete = False + self.in_do_draw = False # Virtual methods, note do_size_alloc needs gtk 2.9 + def do_size_allocate(self, allocation): @@ -658,9 +694,10 @@ class MaskedEntry(UndoableEntry): self._icon.resize_windows() def do_draw(self, cairo_t): + #TODO GTK3: It seems this is called in a loop, test, add print here Gtk.Entry.do_draw(self, cairo_t) - if Gtk.cairo_should_draw_window(cairo_t, self.get_root_window()): + if Gtk.cairo_should_draw_window(cairo_t, self.get_window()): self._icon.draw_pixbuf() def do_realize(self): @@ -939,7 +976,7 @@ class MaskedEntry(UndoableEntry): else: match_func = self._completion_normal_match_func completion = self._get_completion() - completion.set_match_func(match_func) + completion.set_match_func(match_func, None) def is_empty(self): text = self.get_text() @@ -1035,7 +1072,7 @@ class MaskedEntry(UndoableEntry): content = model[iter][COL_TEXT] return content.startswith(self.get_text()) - def _completion_normal_match_func(self, completion, key, iter): + def _completion_normal_match_func(self, completion, key, iter, data=None): model = completion.get_model() if not len(model): return @@ -1043,7 +1080,7 @@ class MaskedEntry(UndoableEntry): content = model[iter][COL_TEXT].lower() return key.lower() in content - def _on_completion__match_selected(self, completion, model, iter): + def _on_completion__match_selected(self, completion, model, iter, data=None): if not len(model): return