Verified Commit c3d97bfe authored by tallero's avatar tallero

upgrade libhandy to v0.0.10

parent c64ad366
......@@ -53,6 +53,10 @@ def main():
action='store',
default=['en'],
help="start daty in a given language (stub)")
parser.add_argument('--mobile',
action="store_true",
default=False,
help="whether to show window controls")
parser.add_argument('--verbose',
dest='verbose',
action='store_true',
......
......@@ -53,6 +53,7 @@ class Config:
dirs = {'data':user_data_dir(appname, appauthor),
'config':user_config_dir(appname, appauthor),
'cache':user_cache_dir(appname, appauthor)}
mobile = False
verbose = True
......@@ -60,7 +61,6 @@ class Config:
self.set_dirs()
self.set_locales()
self.set_resources()
self.tette = 3
if not exists(join(self.dirs['config'], "config.pkl")):
self.data = {}
else:
......@@ -165,6 +165,6 @@ class Config:
path = join(self.exec_path, 'resources', 'daty.gresource')
resource = resource_load(path)
Resource._register(resource)
if self.verbose:
if not self.verbose:
print(resource.lookup_data("/ml/prevete/Daty/gtk/filterslist.ui",
ResourceLookupFlags(0)))
......@@ -36,7 +36,7 @@ from gi.repository.Gtk import AccelGroup, ApplicationWindow, IconTheme, IMContex
from gi.repository.Handy import Column
from pprint import pprint
from threading import Thread
from webbrowser import open
from webbrowser import open as browser_open
from .entityselectable import EntitySelectable
from .loadingpage import LoadingPage
......@@ -129,6 +129,7 @@ class Editor(ApplicationWindow):
ApplicationWindow.__init__(self, *args, **kwargs)
self.quit_cb = quit_cb
self.open_dialogs = []
# Set window icon
icon = lambda x: IconTheme.get_default().load_icon((name), x, 0)
......@@ -146,6 +147,7 @@ class Editor(ApplicationWindow):
add_accelerator(accelerators, self.cancel_entities_selection, "<Control><Shift>s", signal="clicked")
add_accelerator(accelerators, self.entities_search, "<Control><Shift>f", signal="activate")
# Init sidebar
self.sidebar_list = SidebarList()
self.sidebar_list.connect("entity-selected", self.sidebar_row_selected_cb)
......@@ -155,8 +157,6 @@ class Editor(ApplicationWindow):
loading = LoadingPage()
self.pages.add_titled(loading, "loading", "Loading")
#self.entity_search_entry.grab_focus()
# Parse args
self.max_pages = max_pages
if entities:
......@@ -165,8 +165,9 @@ class Editor(ApplicationWindow):
entities_open_dialog = Open(quit_cb=self.quit_cb,
new_session=True)
entities_open_dialog.connect("new-window-clicked", self.new_window_clicked_cb)
entities_open_dialog.connect("window-new", self.open_window_new_clicked_cb)
self.open_dialogs.append(entities_open_dialog)
entities_open_dialog.get_focus()
#entities_open_dialog.show_all()
def filter(self, query, text):
return query.lower() in text.lower()
......@@ -526,22 +527,40 @@ class Editor(ApplicationWindow):
open_dialog = Open(quit_cb=self.quit_cb, new_session=False)
open_dialog.connect("entity-new", self.entity_new_clicked_cb)
open_dialog.connect("new-window-clicked", self.new_window_clicked_cb)
open_dialog.connect("window-new", self.open_window_new_clicked_cb)
self.open_dialogs.append(open_dialog)
def new_window_clicked_cb(self, dialog, entities):
self.load(entities)
print("Editor: new window clicked")
#print("Editor: new window clicked")
#open_dialog = Open(quit_cb=self.quit_cb, new_session=False)
#open_dialog.connect("entity-new", self.entity_new_clicked_cb)
#open_dialog.connect("new-window-clicked", self.new_window_clicked_cb)
#open_dialog.connect("window-new", self.open_window_new_clicked_cb)
#self.open_dialogs.append(open_dialog)
def open_window_new_clicked_cb(self, dialog, good):
print(good)
print("Editor: new open dialog")
open_dialog = Open(quit_cb=self.quit_cb, new_session=False)
open_dialog.connect("entity-new", self.entity_new_clicked_cb)
open_dialog.connect("new-window-clicked", self.new_window_clicked_cb)
open_dialog.connect("window-new", self.open_window_new_clicked_cb)
self.open_dialogs.append(open_dialog)
def entity_new_clicked_cb(self, open, query):
print("New entity", query)
def entity_history_open_external_clicked_cb(self, widget, URI):
open(''.join(['https://wikidata.org/w/index.php?action=history&title=', URI]))
browser_open(''.join(['https://wikidata.org/w/index.php?action=history&title=', URI]))
def entity_discussion_open_external_clicked_cb(self, widget, URI):
open(''.join(['https://www.wikidata.org/wiki/Talk:', URI]))
browser_open(''.join(['https://www.wikidata.org/wiki/Talk:', URI]))
def entity_open_external_clicked_cb(self, widget, URI):
open('/'.join(['https://wikidata.org/wiki', URI]))
browser_open('/'.join(['https://wikidata.org/wiki', URI]))
@Template.Callback()
def entities_search_toggled_cb(self, widget):
......
......@@ -187,6 +187,11 @@ class Entity(Stack):
self.URI = URI
self.set_text(entity["Label"], entity["Description"])
self.show_all()
if self.new:
self.set_visible_child_name('entry')
self.entry.grab_focus()
return None
@Template.Callback()
......@@ -228,7 +233,7 @@ class Entity(Stack):
self.popover.set_visible(True)
self.emit("entity-editing", self.popover)
except AttributeError as e:
#raise e
raise e
print("no popover available for this type of value")
else:
self.entry.emit("search-changed")
......
......@@ -56,7 +56,10 @@ class Open(Window):
(TYPE_PYOBJECT,)),
'new-window-clicked':(sf.RUN_LAST,
TYPE_NONE,
(TYPE_PYOBJECT,))}
(TYPE_PYOBJECT,)),
'window-new':(sf.RUN_LAST,
TYPE_NONE,
(TYPE_PYOBJECT,))}
wikidata = Wikidata()
......@@ -481,3 +484,8 @@ class Open(Window):
@Template.Callback()
def deselect_all_clicked_cb(self, widget):
self.results_listbox.foreach(self.select_row, False)
@Template.Callback()
def window_new_clicked_cb(self, widget):
self.emit("window-new", "ciao")
print("open dialog: window new clicked")
......@@ -93,6 +93,7 @@ class Page(ScrolledWindow):
frame.set_visible(True)
values = Values()
values.connect("reference-toggled", self.reference_toggled_cb, frame)
frame.add(values)
self.statements.attach(frame, 1, i, 3, 1)
for claim in claims[P]:
......@@ -144,12 +145,13 @@ class Page(ScrolledWindow):
'numeric-id':1}},
'datatype':'wikibase-item'}}
value = Value(claim=claim, new=True)
values.add(value)
values.insert(value,0)
values.show_all()
event = EventButton()
value.entity.value_eventbox.do_button_press_event(self, event)
value.entity.set_visible_child_name('entry')
value.entity.entry.grab_focus()
#event = EventButton()
#value.entity.value_eventbox.do_button_press_event(self, event)
#value.entity.set_visible_child_name('entry')
#value.entity.entry.grab_focus()
#values.show_all()
def load_value_async(self, claim, values):
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<!-- interface-css-provider-path entity.css -->
......@@ -66,8 +66,6 @@
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="margin_start">6</property>
<property name="has_frame">False</property>
<property name="shadow_type">none</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="secondary_icon_name">user-trash-symbolic</property>
<property name="primary_icon_activatable">False</property>
......@@ -80,6 +78,7 @@
<style>
<class name="flat"/>
<class name="search_entry"/>
<class name="dim-label"/>
</style>
</object>
<packing>
......
......@@ -105,99 +105,6 @@
<property name="default_height">768</property>
<property name="gravity">center</property>
<signal name="key-press-event" handler="key_press_event_cb" swapped="no"/>
<child type="titlebar">
<object class="HdyTitleBar" id="titlebar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Daty</property>
<property name="subtitle" translatable="yes">Open entities</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="open_session">
<property name="label" translatable="yes">Load saved session</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Open a pre-existing session</property>
<accelerator key="o" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkButton" id="back">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Close this window and come back to the editor</property>
<property name="image">back-icon</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="back_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="app_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Application menu</property>
<property name="image">app_menu_image</property>
<signal name="clicked" handler="app_menu_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label" translatable="yes">Help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">help_image</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="help_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="select">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Select</property>
<property name="image">select-icon</property>
<signal name="clicked" handler="select_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label" translatable="yes">Cancel</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Exit from selection mode</property>
<signal name="clicked" handler="select_clicked_cb" swapped="no"/>
<accelerator key="o" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......@@ -1046,6 +953,99 @@
</child>
</object>
</child>
<child type="titlebar">
<object class="HdyTitleBar" id="titlebar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="title" translatable="yes">Daty</property>
<property name="subtitle" translatable="yes">Open entities</property>
<property name="show_close_button">True</property>
<child>
<object class="GtkButton" id="open_session">
<property name="label" translatable="yes">Load saved session</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Open a pre-existing session</property>
<accelerator key="o" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
</child>
<child>
<object class="GtkButton" id="back">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Close this window and come back to the editor</property>
<property name="image">back-icon</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="back_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="app_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Application menu</property>
<property name="image">app_menu_image</property>
<signal name="clicked" handler="app_menu_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="help">
<property name="label" translatable="yes">Help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">help_image</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="help_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton" id="select">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Select</property>
<property name="image">select-icon</property>
<signal name="clicked" handler="select_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkButton" id="cancel">
<property name="label" translatable="yes">Cancel</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Exit from selection mode</property>
<signal name="clicked" handler="select_clicked_cb" swapped="no"/>
<accelerator key="o" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">5</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</template>
<object class="GtkPopoverMenu" id="app_menu">
<property name="can_focus">False</property>
......@@ -1059,6 +1059,21 @@
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton" id="window_new">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Select all entities shown in the results</property>
<property name="text" translatable="yes">New window</property>
<signal name="clicked" handler="window_new_clicked_cb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkModelButton" id="help_menu">
<property name="can_focus">True</property>
......@@ -1070,7 +1085,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="position">1</property>
</packing>
</child>
<child>
......@@ -1085,7 +1100,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
......
......@@ -34,7 +34,7 @@
"sources" : [
{
"type" : "git",
"tag" : "v0.0.9",
"tag" : "v0.0.10",
"url" : "https://source.puri.sm/Librem5/libhandy.git"
}
]
......@@ -50,7 +50,7 @@
{
"type" : "git",
"tag": "1.0beta",
"url" : "https://gitlab.gnome.org/World/daty"
"url" : "https://gitlab.gnome.org/World/Daty"
},
{
"type" : "file",
......
......@@ -20,6 +20,7 @@
"--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"modules" : [
"plotinus.json",
"python3-appdirs.json",
"python3-beautifulsoup4.json",
"python3-bleach.json",
......@@ -39,7 +40,7 @@
"sources" : [
{
"type" : "git",
"tag" : "v0.0.9",
"tag" : "v0.0.10",
"url" : "https://source.puri.sm/Librem5/libhandy.git"
}
]
......@@ -68,7 +69,7 @@
],
"build-options" : {
"env" : {
"GTK_DEBUG" : "touchscreen"
"GTK_DEBUG" : "interactive"
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment