Validated masked entry does not crash anymore (does not work correct however)

No separator anymore in dialog
Remove ComboBoxEntry


svn: r19876
This commit is contained in:
Benny Malengier 2012-06-19 10:36:12 +00:00
parent ff93112221
commit ab89662e64
36 changed files with 141 additions and 68 deletions

View File

@ -101,7 +101,6 @@ class EditTagList(ManagedWindow):
top = Gtk.Dialog(title)
top.set_default_size(360, 400)
top.set_modal(True)
top.set_has_separator(False)
top.vbox.set_spacing(5)
columns = [('', -1, 300),

View File

@ -8,7 +8,6 @@
<property name="default_width">600</property>
<property name="default_height">450</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox22">
<property name="visible">True</property>

View File

@ -7,7 +7,6 @@
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox23">
<property name="visible">True</property>

View File

@ -9,7 +9,6 @@
<property name="default_width">710</property>
<property name="default_height">300</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox26">
<property name="visible">True</property>
@ -295,7 +294,6 @@
<property name="window_position">center-on-parent</property>
<property name="default_width">450</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox27">
<property name="visible">True</property>

View File

@ -97,12 +97,18 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="attr_menu">
<object class="GtkComboBox" id="attr_menu">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">The name of an attribute you want to use. For example: Height (for a person), Weather on this Day (for an event), ...
Use this to store snippets of information you collect and want to correctly link to sources. Attributes can be used for people, families, events and media.
Note: several predefined attributes refer to values present in the GEDCOM standard.</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="attr_menu-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -37,8 +37,14 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="mrel">
<object class="GtkComboBox" id="mrel">
<property name="visible">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="mrel-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -159,7 +159,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="quality_box">
<object class="GtkComboBoxText" id="quality_box">
<property name="visible">True</property>
<property name="model">quality_model</property>
<child>
@ -198,7 +198,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="type_box">
<object class="GtkComboBoxText" id="type_box">
<property name="visible">True</property>
<property name="model">type_model</property>
<child>
@ -301,7 +301,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="start_month_box">
<object class="GtkComboBoxText" id="start_month_box">
<property name="visible">True</property>
<property name="model">month_model1</property>
<child>
@ -420,7 +420,7 @@
</packing>
</child>
<child>
<object class="GtkComboBox" id="stop_month_box">
<object class="GtkComboBoxText" id="stop_month_box">
<property name="visible">True</property>
<property name="model">month_model2</property>
<child>

View File

@ -86,8 +86,14 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="eer_role_combo">
<object class="GtkComboBox" id="eer_role_combo">
<property name="visible">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="eer_role_combo-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@ -343,8 +349,14 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="eer_type_combo">
<object class="GtkComboBox" id="eer_type_combo">
<property name="visible">True</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="eer_type_combo-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -630,9 +630,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="marriage_type">
<object class="GtkComboBox" id="marriage_type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">The relationship type, eg 'Married' or 'Unmarried'. Use Events for more details.</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="marriage_type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">3</property>

View File

@ -36,9 +36,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="ntype">
<object class="GtkComboBox" id="ntype">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">An identification of what type of Name this is, eg. Birth Name, Married Name.</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="ntype-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@ -76,9 +76,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="type">
<object class="GtkComboBox" id="type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">A type to classify the note.</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">3</property>

View File

@ -73,9 +73,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="media_type">
<object class="GtkComboBox" id="media_type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">On what type of media this source is available in the repository.</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="media_type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
@ -321,9 +327,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="repo_type">
<object class="GtkComboBox" id="repo_type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Type of repository, eg., 'Library', 'Album', ...</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="repo_type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -68,9 +68,15 @@
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<object class="GtkComboBoxEntry" id="repository_type">
<object class="GtkComboBox" id="repository_type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Type of repository, eg., 'Library', 'Album', ...</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="repository_type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>

View File

@ -97,9 +97,15 @@
</packing>
</child>
<child>
<object class="GtkComboBoxEntry" id="type">
<object class="GtkComboBox" id="type">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">Type of internet address, eg. E-mail, Web Page, ...</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry" id="type-entry">
<property name="can_focus">False</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">600</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">700</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -6,7 +6,6 @@
<property name="modal">True</property>
<property name="default_width">500</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -10,7 +10,6 @@
<property name="default_height">500</property>
<property name="destroy_with_parent">True</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>

View File

@ -716,7 +716,6 @@ class ToolManagedWindowBase(ManagedWindow):
window = Gtk.Dialog('Tool')
self.set_window(window, None, self.get_title())
#self.window.set_has_separator(False)
#self.window.connect('response', self.close)
self.cancel = self.window.add_button(Gtk.STOCK_CLOSE,

View File

@ -154,7 +154,6 @@ class ReportDialog(ManagedWindow):
window = Gtk.Dialog('Gramps')
self.set_window(window, None, self.get_title())
self.window.set_has_separator(False)
self.window.set_modal(True)
self.help = self.window.add_button(Gtk.STOCK_HELP, Gtk.ResponseType.HELP)

View File

@ -86,8 +86,6 @@ class CLIDialog:
"""
def connect(self, signal, callback):
pass
def set_has_separator(self, flag):
pass
def set_title(self, title):
pass
def set_border_width(self, width):
@ -150,7 +148,6 @@ class ProgressMeter(object):
self.__dialog.connect('delete_event', self.__cancel_callback)
else:
self.__dialog.connect('delete_event', self.__warn)
self.__dialog.set_has_separator(False)
self.__dialog.set_title(title)
self.__dialog.set_border_width(12)
self.__dialog.vbox.set_spacing(10)

View File

@ -201,7 +201,6 @@ class Bookmarks :
self.top.set_default_size(400, 350)
self.top.set_modal(True)
self.top.set_transient_for(self.uistate.window)
self.top.set_has_separator(False)
self.top.vbox.set_spacing(5)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
% _("Organize Bookmarks"))

View File

@ -373,7 +373,6 @@ class OrganizeTagsDialog(object):
top.set_default_size(400, 350)
top.set_modal(True)
top.set_transient_for(self.parent_window)
top.set_has_separator(False)
top.vbox.set_spacing(5)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>'
% _("Organize Tags"))
@ -583,7 +582,6 @@ class EditTag(object):
top.set_default_size(300, 100)
top.set_modal(True)
top.set_transient_for(self.parent_window)
top.set_has_separator(False)
top.vbox.set_spacing(5)
hbox = Gtk.HBox()

View File

@ -484,7 +484,6 @@ class GtkProgressDialog(Gtk.Dialog):
"""
GObject.GObject.__init__(self, *window_params)
self.connect('delete_event', self._warn)
self.set_has_separator(False)
self.set_title(title)
#self.set_resize_mode(Gtk.RESIZE_IMMEDIATE)
#self.show()

View File

@ -40,6 +40,7 @@ _LOG = logging.getLogger(".widgets.undoableentry")
#
#-------------------------------------------------------------------------
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
#-------------------------------------------------------------------------

View File

@ -41,6 +41,7 @@ _LOG = logging.getLogger(".widgets.validatedmaskedentry")
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from gi.repository import Pango
#-------------------------------------------------------------------------
@ -232,7 +233,7 @@ class Tooltip(Gtk.Window):
# from gtktooltips.c:gtk_tooltips_paint_window
def _on__draw_event(self, window, cairo_context):
w, h = window.size_request()
window.style.paint_flat_box(window.window,
window.get_style().paint_flat_box(window.window,
Gtk.StateType.NORMAL, Gtk.ShadowType.OUT,
None, window, "tooltip",
0, 0, w, h)
@ -411,25 +412,54 @@ class IconEntry(object):
entry.realize()
# Hack: Save a reference to the text area, now when its created
self._text_area = entry.window.get_children()[0]
self._text_area = entry.get_root_window().get_children()[0]
self._text_area_pos = self._text_area.get_position()
# PyGTK should allow default values for most of the values here.
win = Gdk.Window(entry.window,
self._pixw, self._pixh,
Gdk.WINDOW_CHILD,
(Gdk.EventMask.ENTER_NOTIFY_MASK |
Gdk.EventMask.LEAVE_NOTIFY_MASK),
Gdk.INPUT_OUTPUT,
'icon window',
0, 0,
entry.get_visual(),
entry.get_colormap(),
Gdk.Cursor.new(entry.get_display(), Gdk.CursorType.LEFT_PTR),
'', '', True)
attr = Gdk.WindowAttr()
attr.width = self._pixw
attr.height = self._pixh
attr.x = 0
attr.y = 0
attr.cursor = Gdk.Cursor.new_for_display(
entry.get_display(), Gdk.CursorType.LEFT_PTR)
#attr.wmclass_name=''
#attr.wmclass_class=''
attr.override_redirect=True
attr.event_mask = (Gdk.EventMask.ENTER_NOTIFY_MASK |
Gdk.EventMask.LEAVE_NOTIFY_MASK)
# TODO GTK3 Why can we not set title?
#attr.title = 'icon window'
attr.wclass = Gdk.WindowWindowClass.INPUT_OUTPUT
attr.window_type = Gdk.WindowType.CHILD
attr.visual = entry.get_visual()
attrmask = (
#Gdk.WindowAttributesType.TITLE |
Gdk.WindowAttributesType.X |
Gdk.WindowAttributesType.Y |
Gdk.WindowAttributesType.CURSOR |
Gdk.WindowAttributesType.VISUAL |
Gdk.WindowAttributesType.NOREDIR
)
win = Gdk.Window(entry.get_root_window(),
attr,
attrmask)
## Gdk.WindowType.CHILD,
## (Gdk.EventMask.ENTER_NOTIFY_MASK |
## Gdk.EventMask.LEAVE_NOTIFY_MASK),
## Gdk.WindowWindowClass.INPUT_OUTPUT,
## title='icon window',
## x=0, y=0,
## visual=entry.get_visual(),
## #TODO GTK3: is there alternative for:
## #colormap=entry.get_colormap(),
## cursor=Gdk.Cursor.new_for_display(
## entry.get_display(), Gdk.CursorType.LEFT_PTR),
## wmclass_name='',
## wmclass_class='', override_redirect=True)
self._icon_win = win
win.set_user_data(entry)
win.set_background(entry.style.base[entry.state])
win.set_background(entry.get_style().base[entry.get_state()])
self._constructed = True
def deconstruct(self):
@ -453,7 +483,7 @@ class IconEntry(object):
self.draw_pixbuf()
def get_background(self):
return self._entry.style.base[Gtk.StateType.NORMAL]
return self._entry.get_style().base[Gtk.StateType.NORMAL]
def resize_windows(self):
if not self._pixbuf:
@ -462,8 +492,10 @@ class IconEntry(object):
icony = iconx = 4
# Make space for the icon, both windows
winw = self._entry.window.get_size()[0]
textw, texth = self._text_area.get_size()
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)
if self._pos == Gtk.PositionType.LEFT:
@ -486,7 +518,7 @@ 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_size() != (self._pixw, self._pixh):
if (icon_win.get_width(), icon_win.get_height()) != (self._pixw, self._pixh):
icon_win.move_resize(iconx, icony, self._pixw, self._pixh)
else:
icon_win.move(iconx, icony)
@ -501,7 +533,7 @@ class IconEntry(object):
return
# Draw background first
color = self._entry.style.base_gc[self._entry.state]
color = self._entry.get_style().base_gc[self._entry.get_state()]
win.draw_rectangle(color, True,
0, 0, self._pixw, self._pixh)
@ -625,10 +657,10 @@ class MaskedEntry(UndoableEntry):
if self.get_realized():
self._icon.resize_windows()
def do_expose_event(self, event):
Gtk.Entry.do_expose_event(self, event)
def do_draw(self, cairo_t):
Gtk.Entry.do_draw(self, cairo_t)
if event.window == self.window:
if Gtk.cairo_should_draw_window(cairo_t, self.get_root_window()):
self._icon.draw_pixbuf()
def do_realize(self):

View File

@ -160,8 +160,8 @@ class FanChartWidget(Gtk.Widget):
self.window = Gdk.Window(self.get_parent_window(),
width=self.allocation.width,
height=self.allocation.height,
window_type=Gdk.WINDOW_CHILD,
wclass=Gdk.INPUT_OUTPUT,
window_type=Gdk.WindowType.CHILD,
wclass=Gdk.WindowWindowClass.INPUT_OUTPUT,
event_mask=self.get_events() | Gdk.EventMask.EXPOSURE_MASK)
if not hasattr(self.window, "cairo_create"):
self.draw_gc = Gdk.GC(self.window,

View File

@ -116,7 +116,6 @@ class PatchNames(tool.BatchTool, ManagedWindow):
Gtk.DialogFlags.MODAL|Gtk.DialogFlags.DESTROY_WITH_PARENT,
(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
winprefix.set_has_separator(False)
winprefix.vbox.set_spacing(5)
hboxpref = Gtk.HBox()
hboxpref.pack_start(Gtk.Label(_('Prefixes to search for:', True, True, 0)),

View File

@ -167,7 +167,6 @@ class TestcaseGenerator(tool.BatchTool):
title = "%s - Gramps" % _("Generate testcases")
self.top = Gtk.Dialog(title)
self.top.set_default_size(400,150)
self.top.set_has_separator(False)
self.top.vbox.set_spacing(5)
label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>' % _("Generate testcases"))
label.set_use_markup(True)

View File

@ -178,8 +178,8 @@ class FanChartWidget(Gtk.Widget):
self.window = Gdk.Window(self.get_parent_window(),
width=self.allocation.width,
height=self.allocation.height,
window_type=Gdk.WINDOW_CHILD,
wclass=Gdk.INPUT_OUTPUT,
window_type=Gdk.WindowType.CHILD,
wclass=Gdk.WindowWindowClass.INPUT_OUTPUT,
event_mask=self.get_events() | Gdk.EventMask.EXPOSURE_MASK)
if not hasattr(self.window, "cairo_create"):
self.draw_gc = Gdk.GC(self.window,