Adding support for right click

This commit is contained in:
José Carlos Cuevas 2018-09-21 15:32:44 +02:00
parent 37abc5c09b
commit fd1defde40
2 changed files with 50 additions and 3 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.1 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="jsoninspector">
<requires lib="gtk+" version="3.6"/>
<object class="GtkAboutDialog" id="AboutDialog">
@ -13,7 +13,6 @@
<property name="type_hint">normal</property>
<property name="deletable">False</property>
<property name="gravity">center</property>
<property name="has_resize_grip">False</property>
<property name="program_name">JSON Inspector</property>
<property name="version">v2.0</property>
<property name="website">https://github.com/resetreboot/jsoninspector</property>
@ -24,6 +23,9 @@
<property name="license_type">gpl-3-0</property>
<signal name="close" handler="onAboutDialogClose" swapped="no"/>
<signal name="delete-event" handler="onAboutDialogDeleteEvent" swapped="no"/>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="aboutdialog-vbox1">
<property name="can_focus">False</property>
@ -57,6 +59,9 @@
<property name="icon_name">jsoninspector</property>
<signal name="delete-event" handler="onCopyJSONDelete" swapped="no"/>
<signal name="destroy" handler="onCopyJSONDestroy" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>
@ -178,6 +183,9 @@
<property name="window_position">center</property>
<property name="icon_name">jsoninspector</property>
<signal name="delete-event" handler="onMainWindowDelete" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
@ -238,6 +246,36 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">_Copy</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">C_ut</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
@ -288,6 +326,7 @@
<property name="expander_column">treeviewcolumn1</property>
<property name="search_column">0</property>
<property name="level_indentation">1</property>
<signal name="button-press-event" handler="onButtonPressEvent" swapped="no"/>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection"/>
</child>

View file

@ -3,7 +3,7 @@
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio
from gi.repository import Gtk, Gio, Gdk
import json
import sys
@ -196,6 +196,14 @@ class MainWindowMethods(Gtk.Application):
def onAboutDialogDeleteEvent(self, widget, event=None):
pass
def onButtonPressEvent(self, event=None):
if event.type == Gdk.GDK_BUTTON_PRESS and event.button == 3:
pass
return True
else:
return False
class LogicObject(object):
"""