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"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 2.12 -->
|
||||
<!-- interface-naming-policy project-wide -->
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<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>
|
||||
<child>
|
||||
<object class="GtkVBox" id="gvgramplet">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="gvframe">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="border_width">10</property>
|
||||
<property name="label_xalign">0</property>
|
||||
@ -18,6 +20,7 @@
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox143">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
@ -25,8 +28,6 @@
|
||||
<object class="GtkScrolledWindow" id="gvscrolledwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">automatic</property>
|
||||
<property name="vscrollbar_policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="gvtextview">
|
||||
<property name="visible">True</property>
|
||||
@ -37,6 +38,8 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -45,15 +48,17 @@
|
||||
<child type="label">
|
||||
<object class="GtkHBox" id="hbox144">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="gvproperties">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</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="use_action_appearance">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="gvproperties-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Detach</property>
|
||||
@ -62,6 +67,7 @@
|
||||
<child>
|
||||
<object class="GtkImage" id="gvpropertiesimage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-properties</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="gvpropertiesimage-atkobject">
|
||||
@ -79,12 +85,14 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="gvstate">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup">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">
|
||||
<object class="AtkObject" id="gvstate-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Remove</property>
|
||||
@ -93,6 +101,7 @@
|
||||
<child>
|
||||
<object class="GtkImage" id="gvstateimage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-remove</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="gvstateimage-atkobject">
|
||||
@ -110,12 +119,14 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="gvclose">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</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="use_action_appearance">False</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="gvclose-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Delete</property>
|
||||
@ -124,6 +135,7 @@
|
||||
<child>
|
||||
<object class="GtkImage" id="gvcloseimage">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-close</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="gvcloseimage-atkobject">
|
||||
@ -142,12 +154,16 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="gvtitle">
|
||||
<property name="label" translatable="yes">Gramplet</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -155,6 +171,8 @@
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -292,7 +292,7 @@ class GuiNumberOption(Gtk.SpinButton):
|
||||
import math
|
||||
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)
|
||||
|
||||
self.set_value(self.__option.get_value())
|
||||
|
@ -966,7 +966,12 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
msg = _("Right click to add gramplets")
|
||||
self.set_tooltip_text(msg)
|
||||
self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
|
||||
self.eventb = Gtk.EventBox()
|
||||
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
|
||||
self.drag_dest_set(Gtk.DestDefaults.MOTION |
|
||||
Gtk.DestDefaults.HIGHLIGHT |
|
||||
@ -978,9 +983,8 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
tglist.add(tg[0], tg[1], tg[2])
|
||||
self.drag_dest_set_target_list(tglist)
|
||||
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:
|
||||
self.columns = []
|
||||
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
|
||||
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)
|
||||
else:
|
||||
button = context.get_source_widget()
|
||||
if button:
|
||||
hbox = button.get_parent()
|
||||
mframe = hbox.get_parent()
|
||||
mainframe = mframe.get_parent() # actually a vbox
|
||||
@ -1249,6 +1259,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
if x < (sx/len(self.columns) * (i + 1)):
|
||||
col = i
|
||||
break
|
||||
if button:
|
||||
fromcol = mainframe.get_parent()
|
||||
if fromcol:
|
||||
fromcol.remove(mainframe)
|
||||
@ -1369,7 +1380,7 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
else:
|
||||
pos = 0
|
||||
self.columns[pos].pack_start(gramplet.mainframe,
|
||||
expand=gramplet.expand)
|
||||
gramplet.expand, True, 0)
|
||||
# set height on gramplet.scrolledwindow here:
|
||||
gramplet.scrolledwindow.set_size_request(-1, gramplet.height)
|
||||
## now drop it in right place
|
||||
@ -1413,9 +1424,10 @@ class GrampletPane(Gtk.ScrolledWindow):
|
||||
add_menuitem(qr_menu, name, None,
|
||||
self.restore_gramplet)
|
||||
rg_menu.set_submenu(qr_menu)
|
||||
menu = uiman.get_widget('/GrampletPopup')
|
||||
if menu:
|
||||
menu.popup(None, None, None, None, 1, event.time)
|
||||
self.menu = uiman.get_widget('/GrampletPopup')
|
||||
if self.menu:
|
||||
#GTK3 does not show the popup, workaround: menu as attribute
|
||||
self.menu.popup(None, None, None, None, event.button, event.time)
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -76,8 +76,8 @@ class AgeOnDateGramplet(Gramplet):
|
||||
button.connect("clicked", self.run)
|
||||
##self.filter =
|
||||
hbox.pack_start(label, False, True, 0)
|
||||
hbox.pack_start(self.entry, True)
|
||||
vbox.pack_start(description, True)
|
||||
hbox.pack_start(self.entry, True, True, 0)
|
||||
vbox.pack_start(description, True, True, 0)
|
||||
vbox.pack_start(hbox, False, True, 0)
|
||||
vbox.pack_start(button, False, True, 0)
|
||||
self.gui.get_container_widget().remove(self.gui.textview)
|
||||
|
Loading…
Reference in New Issue
Block a user