added shortcuts and a menu
This commit is contained in:
parent
77070e5823
commit
3aaa778194
5 changed files with 60 additions and 19 deletions
|
@ -10,14 +10,15 @@ A nut obsessed saber-toothed client for pnut.io
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] Compose window
|
- [x] Compose window
|
||||||
|
- [x] Menu (about, refresh, logout)
|
||||||
|
- [x] Keyboard shortcuts
|
||||||
- [ ] Avatars
|
- [ ] Avatars
|
||||||
- [ ] Post actions (reply, bookmark, repost, quote, copy, delete)
|
- [ ] Post actions (reply, bookmark, repost, quote, copy, delete)
|
||||||
|
- [ ] Loading indicator
|
||||||
- [ ] Load newer posts
|
- [ ] Load newer posts
|
||||||
- [ ] Load older posts
|
- [ ] Load older posts
|
||||||
- [ ] Keyboard shortcuts
|
|
||||||
- [ ] Render post media
|
- [ ] Render post media
|
||||||
- [ ] Menu (about, refresh, logout, quit)
|
|
||||||
- [ ] Settings page
|
- [ ] Settings page
|
||||||
- [ ] App icon and package metadata
|
- [ ] App icon and package metadata
|
||||||
- [ ] Post media / upload files
|
- [ ] Post media / upload files
|
||||||
|
|
54
src/main.py
54
src/main.py
|
@ -57,6 +57,32 @@ class Application(Gtk.Application):
|
||||||
except GLib.Error:
|
except GLib.Error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
action = Gio.SimpleAction.new('newpost', None)
|
||||||
|
action.connect('activate', self.on_new_post)
|
||||||
|
self.add_action(action)
|
||||||
|
self.set_accels_for_action('app.newpost',["<Ctrl>n"])
|
||||||
|
|
||||||
|
action = Gio.SimpleAction.new('refresh', None)
|
||||||
|
action.connect('activate', self.on_refresh)
|
||||||
|
self.add_action(action)
|
||||||
|
self.set_accels_for_action('app.refresh',["<Ctrl>r"])
|
||||||
|
|
||||||
|
action = Gio.SimpleAction.new('preferences', None)
|
||||||
|
action.connect('activate', self.on_preferences)
|
||||||
|
self.add_action(action)
|
||||||
|
self.set_accels_for_action('app.preferences',["<Ctrl>,"])
|
||||||
|
|
||||||
|
action = Gio.SimpleAction.new('about', None)
|
||||||
|
action.connect('activate', self.on_about)
|
||||||
|
self.add_action(action)
|
||||||
|
|
||||||
|
action = Gio.SimpleAction.new('quit', None)
|
||||||
|
action.connect('activate', self.on_quit)
|
||||||
|
self.add_action(action)
|
||||||
|
self.set_accels_for_action('app.quit',["<Ctrl>q"])
|
||||||
|
|
||||||
|
self.builder = Gtk.Builder.new_from_resource("/dev/thrrgilag/squeak/menu.ui")
|
||||||
|
|
||||||
def do_activate(self):
|
def do_activate(self):
|
||||||
self.win = self.props.active_window
|
self.win = self.props.active_window
|
||||||
if not self.win:
|
if not self.win:
|
||||||
|
@ -133,21 +159,35 @@ class Application(Gtk.Application):
|
||||||
new_post_button.connect('clicked', self.on_new_post)
|
new_post_button.connect('clicked', self.on_new_post)
|
||||||
self.header.pack_start(new_post_button)
|
self.header.pack_start(new_post_button)
|
||||||
|
|
||||||
reload_button = Gtk.Button.new_from_icon_name('view-refresh-symbolic', 1)
|
menu = self.builder.get_object("app-menu")
|
||||||
reload_button.connect('clicked', self.emit_refresh)
|
menu_button = Gtk.Button.new_from_icon_name('open-menu-symbolic', 1)
|
||||||
self.header.pack_start(reload_button)
|
menu_button.connect('clicked', self.on_main_popover)
|
||||||
|
self.main_popover = Gtk.Popover.new_from_model(menu_button, menu)
|
||||||
|
self.header.pack_end(menu_button)
|
||||||
|
|
||||||
self.header.show_all()
|
self.header.show_all()
|
||||||
|
|
||||||
self.stack.show_all()
|
self.stack.show_all()
|
||||||
|
|
||||||
def emit_refresh(self, button):
|
def on_new_post(self, widget, param=None):
|
||||||
|
compose = ComposeWindow()
|
||||||
|
compose.set_transient_for(self.win)
|
||||||
|
|
||||||
|
def on_main_popover(self, button):
|
||||||
|
self.main_popover.popup()
|
||||||
|
|
||||||
|
def on_refresh(self, action, param):
|
||||||
timeline = self.stack.get_visible_child()
|
timeline = self.stack.get_visible_child()
|
||||||
timeline.emit('refresh')
|
timeline.emit('refresh')
|
||||||
|
|
||||||
def on_new_post(self, button):
|
def on_preferences(self, action, param):
|
||||||
compose = ComposeWindow()
|
pass
|
||||||
compose.set_transient_for(self.win)
|
|
||||||
|
def on_about(self, action, param):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def on_quit(self, action, param):
|
||||||
|
self.quit()
|
||||||
|
|
||||||
def main(version):
|
def main(version):
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
|
@ -2,12 +2,12 @@ pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.proje
|
||||||
moduledir = join_paths(pkgdatadir, 'squeak')
|
moduledir = join_paths(pkgdatadir, 'squeak')
|
||||||
gnome = import('gnome')
|
gnome = import('gnome')
|
||||||
|
|
||||||
#gnome.compile_resources('squeak',
|
gnome.compile_resources('squeak',
|
||||||
# 'squeak.gresource.xml',
|
'squeak.gresource.xml',
|
||||||
# gresource_bundle: true,
|
gresource_bundle: true,
|
||||||
# install: true,
|
install: true,
|
||||||
# install_dir: pkgdatadir,
|
install_dir: pkgdatadir,
|
||||||
#)
|
)
|
||||||
|
|
||||||
python = import('python')
|
python = import('python')
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ if __name__ == '__main__':
|
||||||
import gi
|
import gi
|
||||||
|
|
||||||
from gi.repository import Gio
|
from gi.repository import Gio
|
||||||
#resource = Gio.Resource.load(os.path.join(pkgdatadir, 'squeak.gresource'))
|
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'squeak.gresource'))
|
||||||
#resource._register()
|
resource._register()
|
||||||
|
|
||||||
from squeak import main
|
from squeak import main
|
||||||
sys.exit(main.main(VERSION))
|
sys.exit(main.main(VERSION))
|
||||||
|
|
|
@ -23,7 +23,7 @@ import logging
|
||||||
|
|
||||||
gi.require_version('Gdk', '3.0')
|
gi.require_version('Gdk', '3.0')
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import GObject, Gdk, Gtk, Gio, GLib
|
from gi.repository import GObject, Gdk, Gtk
|
||||||
|
|
||||||
gi.require_version('Handy', '1')
|
gi.require_version('Handy', '1')
|
||||||
from gi.repository import Handy
|
from gi.repository import Handy
|
||||||
|
|
Loading…
Reference in a new issue