GTK3: Working Grampletpane in the GrampletView. For right click, eventbox added
Some Gramplets fixed at same time svn: r20102
This commit is contained in:
parent
1f47ab637f
commit
1682fb6945
@ -1,16 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<!-- interface-requires gtk+ 2.12 -->
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
<!-- interface-naming-policy project-wide -->
|
|
||||||
<object class="GtkWindow" id="grampletview">
|
<object class="GtkWindow" id="grampletview">
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||||
<property name="title" translatable="yes">window2</property>
|
<property name="title" translatable="yes">window2</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="gvgramplet">
|
<object class="GtkVBox" id="gvgramplet">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkFrame" id="gvframe">
|
<object class="GtkFrame" id="gvframe">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||||
<property name="border_width">10</property>
|
<property name="border_width">10</property>
|
||||||
<property name="label_xalign">0</property>
|
<property name="label_xalign">0</property>
|
||||||
@ -18,6 +20,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkVBox" id="vbox143">
|
<object class="GtkVBox" id="vbox143">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
@ -25,8 +28,6 @@
|
|||||||
<object class="GtkScrolledWindow" id="gvscrolledwindow">
|
<object class="GtkScrolledWindow" id="gvscrolledwindow">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">automatic</property>
|
|
||||||
<property name="vscrollbar_policy">automatic</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkTextView" id="gvtextview">
|
<object class="GtkTextView" id="gvtextview">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -37,6 +38,8 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
@ -45,15 +48,17 @@
|
|||||||
<child type="label">
|
<child type="label">
|
||||||
<object class="GtkHBox" id="hbox144">
|
<object class="GtkHBox" id="hbox144">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="gvproperties">
|
<object class="GtkButton" id="gvproperties">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="has_tooltip">True</property>
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip_markup">Drag to move; click to detach</property>
|
<property name="tooltip_markup">Drag to move; click to detach</property>
|
||||||
<property name="tooltip_text" translatable="yes">Drag to move; click to detach</property>
|
<property name="tooltip_text" translatable="yes">Drag to move; click to detach</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvproperties-atkobject">
|
<object class="AtkObject" id="gvproperties-atkobject">
|
||||||
<property name="AtkObject::accessible-name" translatable="yes">Detach</property>
|
<property name="AtkObject::accessible-name" translatable="yes">Detach</property>
|
||||||
@ -62,6 +67,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="gvpropertiesimage">
|
<object class="GtkImage" id="gvpropertiesimage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-properties</property>
|
<property name="stock">gtk-properties</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvpropertiesimage-atkobject">
|
<object class="AtkObject" id="gvpropertiesimage-atkobject">
|
||||||
@ -79,12 +85,14 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="gvstate">
|
<object class="GtkButton" id="gvstate">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="has_tooltip">True</property>
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip_markup">Click to expand/collapse</property>
|
<property name="tooltip_markup">Click to expand/collapse</property>
|
||||||
<property name="tooltip_text" translatable="yes">Click to expand/collapse</property>
|
<property name="tooltip_text" translatable="yes">Click to expand/collapse</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvstate-atkobject">
|
<object class="AtkObject" id="gvstate-atkobject">
|
||||||
<property name="AtkObject::accessible-name" translatable="yes">Remove</property>
|
<property name="AtkObject::accessible-name" translatable="yes">Remove</property>
|
||||||
@ -93,6 +101,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="gvstateimage">
|
<object class="GtkImage" id="gvstateimage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-remove</property>
|
<property name="stock">gtk-remove</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvstateimage-atkobject">
|
<object class="AtkObject" id="gvstateimage-atkobject">
|
||||||
@ -110,12 +119,14 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="gvclose">
|
<object class="GtkButton" id="gvclose">
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="has_tooltip">True</property>
|
<property name="has_tooltip">True</property>
|
||||||
<property name="tooltip_markup">Click to delete gramplet from view</property>
|
<property name="tooltip_markup">Click to delete gramplet from view</property>
|
||||||
<property name="tooltip_text" translatable="yes">Click to delete gramplet from view</property>
|
<property name="tooltip_text" translatable="yes">Click to delete gramplet from view</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvclose-atkobject">
|
<object class="AtkObject" id="gvclose-atkobject">
|
||||||
<property name="AtkObject::accessible-name" translatable="yes">Delete</property>
|
<property name="AtkObject::accessible-name" translatable="yes">Delete</property>
|
||||||
@ -124,6 +135,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkImage" id="gvcloseimage">
|
<object class="GtkImage" id="gvcloseimage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
<property name="stock">gtk-close</property>
|
<property name="stock">gtk-close</property>
|
||||||
<child internal-child="accessible">
|
<child internal-child="accessible">
|
||||||
<object class="AtkObject" id="gvcloseimage-atkobject">
|
<object class="AtkObject" id="gvcloseimage-atkobject">
|
||||||
@ -142,12 +154,16 @@
|
|||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="gvtitle">
|
<object class="GtkButton" id="gvtitle">
|
||||||
<property name="label" translatable="yes">Gramplet</property>
|
<property name="label" translatable="yes">Gramplet</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
<property name="relief">none</property>
|
<property name="relief">none</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">3</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
@ -155,6 +171,8 @@
|
|||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -292,7 +292,7 @@ class GuiNumberOption(Gtk.SpinButton):
|
|||||||
import math
|
import math
|
||||||
decimals = int(math.log10(step) * -1)
|
decimals = int(math.log10(step) * -1)
|
||||||
|
|
||||||
GObject.GObject.__init__(self, adj, digits=decimals)
|
GObject.GObject.__init__(self, adjustment=adj, climb_rate=1, digits=decimals)
|
||||||
Gtk.SpinButton.set_numeric(self, True)
|
Gtk.SpinButton.set_numeric(self, True)
|
||||||
|
|
||||||
self.set_value(self.__option.get_value())
|
self.set_value(self.__option.get_value())
|
||||||
|
@ -966,7 +966,12 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
msg = _("Right click to add gramplets")
|
msg = _("Right click to add gramplets")
|
||||||
self.set_tooltip_text(msg)
|
self.set_tooltip_text(msg)
|
||||||
self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||||
|
self.eventb = Gtk.EventBox()
|
||||||
self.hbox = Gtk.HBox(homogeneous=True)
|
self.hbox = Gtk.HBox(homogeneous=True)
|
||||||
|
self.eventb.add(self.hbox)
|
||||||
|
self.add_with_viewport(self.eventb)
|
||||||
|
self.set_kinetic_scrolling(True)
|
||||||
|
self.set_capture_button_press(True)
|
||||||
# Set up drag and drop
|
# Set up drag and drop
|
||||||
self.drag_dest_set(Gtk.DestDefaults.MOTION |
|
self.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||||
Gtk.DestDefaults.HIGHLIGHT |
|
Gtk.DestDefaults.HIGHLIGHT |
|
||||||
@ -978,9 +983,8 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
tglist.add(tg[0], tg[1], tg[2])
|
tglist.add(tg[0], tg[1], tg[2])
|
||||||
self.drag_dest_set_target_list(tglist)
|
self.drag_dest_set_target_list(tglist)
|
||||||
self.connect('drag_drop', self.drop_widget)
|
self.connect('drag_drop', self.drop_widget)
|
||||||
self.connect('button-press-event', self._button_press)
|
self.eventb.connect('button-press-event', self._button_press)
|
||||||
|
|
||||||
self.add_with_viewport(self.hbox)
|
|
||||||
# Create the columns:
|
# Create the columns:
|
||||||
self.columns = []
|
self.columns = []
|
||||||
for i in range(self.column_count):
|
for i in range(self.column_count):
|
||||||
@ -1236,8 +1240,14 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
"""
|
"""
|
||||||
This is the destination method for handling drag and drop
|
This is the destination method for handling drag and drop
|
||||||
of a gramplet onto the main scrolled window.
|
of a gramplet onto the main scrolled window.
|
||||||
|
Also used for adding new gramplets, then context should be GridGramplet
|
||||||
"""
|
"""
|
||||||
|
button = None
|
||||||
|
if isinstance(context, Gdk.DragContext):
|
||||||
button = Gtk.drag_get_source_widget(context)
|
button = Gtk.drag_get_source_widget(context)
|
||||||
|
else:
|
||||||
|
button = context.get_source_widget()
|
||||||
|
if button:
|
||||||
hbox = button.get_parent()
|
hbox = button.get_parent()
|
||||||
mframe = hbox.get_parent()
|
mframe = hbox.get_parent()
|
||||||
mainframe = mframe.get_parent() # actually a vbox
|
mainframe = mframe.get_parent() # actually a vbox
|
||||||
@ -1249,6 +1259,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
if x < (sx/len(self.columns) * (i + 1)):
|
if x < (sx/len(self.columns) * (i + 1)):
|
||||||
col = i
|
col = i
|
||||||
break
|
break
|
||||||
|
if button:
|
||||||
fromcol = mainframe.get_parent()
|
fromcol = mainframe.get_parent()
|
||||||
if fromcol:
|
if fromcol:
|
||||||
fromcol.remove(mainframe)
|
fromcol.remove(mainframe)
|
||||||
@ -1369,7 +1380,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
else:
|
else:
|
||||||
pos = 0
|
pos = 0
|
||||||
self.columns[pos].pack_start(gramplet.mainframe,
|
self.columns[pos].pack_start(gramplet.mainframe,
|
||||||
expand=gramplet.expand)
|
gramplet.expand, True, 0)
|
||||||
# set height on gramplet.scrolledwindow here:
|
# set height on gramplet.scrolledwindow here:
|
||||||
gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
|
gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
|
||||||
## now drop it in right place
|
## now drop it in right place
|
||||||
@ -1413,9 +1424,10 @@ class GrampletPane(Gtk.ScrolledWindow):
|
|||||||
add_menuitem(qr_menu, name, None,
|
add_menuitem(qr_menu, name, None,
|
||||||
self.restore_gramplet)
|
self.restore_gramplet)
|
||||||
rg_menu.set_submenu(qr_menu)
|
rg_menu.set_submenu(qr_menu)
|
||||||
menu = uiman.get_widget('/GrampletPopup')
|
self.menu = uiman.get_widget('/GrampletPopup')
|
||||||
if menu:
|
if self.menu:
|
||||||
menu.popup(None, None, None, None, 1, event.time)
|
#GTK3 does not show the popup, workaround: menu as attribute
|
||||||
|
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ class AgeOnDateGramplet(Gramplet):
|
|||||||
button.connect("clicked", self.run)
|
button.connect("clicked", self.run)
|
||||||
##self.filter =
|
##self.filter =
|
||||||
hbox.pack_start(label, False, True, 0)
|
hbox.pack_start(label, False, True, 0)
|
||||||
hbox.pack_start(self.entry, True)
|
hbox.pack_start(self.entry, True, True, 0)
|
||||||
vbox.pack_start(description, True)
|
vbox.pack_start(description, True, True, 0)
|
||||||
vbox.pack_start(hbox, False, True, 0)
|
vbox.pack_start(hbox, False, True, 0)
|
||||||
vbox.pack_start(button, False, True, 0)
|
vbox.pack_start(button, False, True, 0)
|
||||||
self.gui.get_container_widget().remove(self.gui.textview)
|
self.gui.get_container_widget().remove(self.gui.textview)
|
||||||
|
Loading…
Reference in New Issue
Block a user