def __init__(self, update_accelerator): Gtk.Dialog.__init__( self, title="Emote Settings", window_position=Gtk.WindowPosition.CENTER, resizable=False, ) self.update_accelerator = update_accelerator header = Gtk.HeaderBar(title="Settings", show_close_button=True) self.set_titlebar(header) box = self.get_content_area() hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=GRID_SIZE) shortcut_label = Gtk.Label() shortcut_label.set_text("Keyboard Shortcut") shortcut_label.set_justify(Gtk.Justification.LEFT) hbox.pack_start(shortcut_label, False, False, GRID_SIZE) shortcut_keybinding = ButtonKeybinding() shortcut_keybinding.set_size_request(150, -1) shortcut_keybinding.connect("accel-edited", self.on_kb_changed) shortcut_keybinding.connect("accel-cleared", self.on_kb_changed) accel_string, _ = user_data.load_accelerator() shortcut_keybinding.set_accel_string(accel_string) hbox.pack_start(shortcut_keybinding, False, False, GRID_SIZE) box.pack_start(hbox, False, False, GRID_SIZE) self.show_all() self.present()
def __init__(self, update_accelerator): Gtk.Dialog.__init__( self, title="Emote Keyboard Shortcuts", window_position=Gtk.WindowPosition.CENTER, resizable=False, ) self.update_accelerator = update_accelerator header = Gtk.HeaderBar(title="Keyboard Shortcuts", show_close_button=True) self.set_titlebar(header) box = self.get_content_area() shortcuts_grid = Gtk.Grid( orientation=Gtk.Orientation.VERTICAL, margin=GRID_SIZE, row_spacing=GRID_SIZE, ) shortcuts_grid.set_row_homogeneous(False) shortcuts_grid.set_column_homogeneous(True) row = 1 if not config.is_wayland: open_label = Gtk.Label("Open Emoji Picker") open_label.set_alignment(0, 0.5) shortcuts_grid.attach(open_label, 1, row, 1, 1) open_keybinding = ButtonKeybinding() open_keybinding.set_size_request(150, -1) open_keybinding.connect("accel-edited", self.on_kb_changed) open_keybinding.connect("accel-cleared", self.on_kb_changed) accel_string, _ = user_data.load_accelerator() open_keybinding.set_accel_string(accel_string) shortcuts_grid.attach(open_keybinding, 2, row, 1, 1) row += 1 select_label = Gtk.Label("Select Emoji") select_label.set_alignment(0, 0.5) shortcuts_grid.attach(select_label, 1, row, 1, 1) select_shortcut = Gtk.ShortcutsShortcut(accelerator="Return") shortcuts_grid.attach(select_shortcut, 2, row, 1, 1) row += 1 select_multi_label = Gtk.Label("Add Emoji to Selection") select_multi_label.set_alignment(0, 0.5) shortcuts_grid.attach(select_multi_label, 1, row, 1, 1) select_multi_shortcut = Gtk.ShortcutsShortcut( accelerator="<Shift>+Return") shortcuts_grid.attach(select_multi_shortcut, 2, row, 1, 1) row += 1 search_label = Gtk.Label("Focus Search") search_label.set_alignment(0, 0.5) shortcuts_grid.attach(search_label, 1, row, 1, 1) search_shortcut = Gtk.ShortcutsShortcut(accelerator="<Ctrl>+F") shortcuts_grid.attach(search_shortcut, 2, row, 1, 1) row += 1 next_cat_label = Gtk.Label("Next Emoji Category") next_cat_label.set_alignment(0, 0.5) shortcuts_grid.attach(next_cat_label, 1, row, 1, 1) next_cat_shortcut = Gtk.ShortcutsShortcut(accelerator="<Ctrl>+Tab") shortcuts_grid.attach(next_cat_shortcut, 2, row, 1, 1) row += 1 prev_cat_label = Gtk.Label("Previous Emoji Category") prev_cat_label.set_alignment(0, 0.5) shortcuts_grid.attach(prev_cat_label, 1, row, 1, 1) prev_cat_label = Gtk.ShortcutsShortcut( accelerator="<Ctrl>+<Shift>+Tab") shortcuts_grid.attach(prev_cat_label, 2, row, 1, 1) row += 1 box.pack_start(shortcuts_grid, True, True, GRID_SIZE) self.show_all() self.present()
def unset_accelerator(self): old_accel_string, _ = user_data.load_accelerator() if old_accel_string: Keybinder.unbind(old_accel_string)
def set_accelerator(self): """Register global shortcut for invoking the emoji picker""" accel_string, _ = user_data.load_accelerator() if accel_string: Keybinder.bind(accel_string, self.handle_accelerator)
def set_accelerator(self): """Register global shortcut for invoking the emoji picker""" accel_string, _ = user_data.load_accelerator() if accel_string: Keybinder.bind(accel_string, lambda x: self.create_picker_window())
def __init__(self): Gtk.Dialog.__init__( self, title="Emote Guide", window_position=Gtk.WindowPosition.CENTER, resizable=False, ) header = Gtk.HeaderBar(title="Guide", show_close_button=True) self.set_titlebar(header) box = self.get_content_area() hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) launching = Gtk.Label() launching.set_markup( '<span size="large" font_weight="bold" underline="single">Launching</span>' ) launching.set_alignment(0, 0.5) vbox.pack_start(launching, True, True, GRID_SIZE) background = Gtk.Label() background.set_markup( "Emote runs in the background and automatically starts when you log in." ) background.set_line_wrap(True) background.set_alignment(0, 0.5) vbox.pack_start(background, True, True, GRID_SIZE) opening = Gtk.Label() opening.set_markup( "The emoji picker can be opened with either the keyboard shortcut or by\n" "clicking the app icon again.") opening.set_line_wrap(True) opening.set_alignment(0, 0.5) vbox.pack_start(opening, True, True, GRID_SIZE) usage = Gtk.Label() usage.set_markup( '<span size="large" font_weight="bold" underline="single">Usage</span>' ) usage.set_alignment(0, 0.5) vbox.pack_start(usage, True, True, GRID_SIZE) copying = Gtk.Label() copying.set_markup( "Select an emoji to copy it to your clipboard. You can then paste the\n" "emoji wherever you need.") copying.set_line_wrap(True) copying.set_alignment(0, 0.5) vbox.pack_start(copying, True, True, GRID_SIZE) multiple = Gtk.Label() multiple.set_markup( "You can select multiple emojis by selecting them with shift left click\n" "or with right click") multiple.set_line_wrap(True) multiple.set_alignment(0, 0.5) vbox.pack_start(multiple, True, True, GRID_SIZE) shortcuts = Gtk.Label() shortcuts.set_markup( '<span size="large" font_weight="bold" underline="single">Keyboard Shortcuts</span>' ) shortcuts.set_alignment(0, 0.5) vbox.pack_start(shortcuts, True, True, GRID_SIZE) _, accel_label = user_data.load_accelerator() launch_shortcut = Gtk.Label() launch_shortcut.set_markup( f'<span font_weight="bold">Open Emoji Picker:</span> {accel_label}' ) launch_shortcut.set_alignment(0, 0.5) vbox.pack_start(launch_shortcut, True, True, GRID_SIZE) _, accel_label = user_data.load_accelerator() select_shortcut = Gtk.Label() select_shortcut.set_markup( f'<span font_weight="bold">Select Emoji:</span> Enter') select_shortcut.set_alignment(0, 0.5) vbox.pack_start(select_shortcut, True, True, GRID_SIZE) _, accel_label = user_data.load_accelerator() select_multi_shortcut = Gtk.Label() select_multi_shortcut.set_markup( f'<span font_weight="bold">Add Emoji to Selection:</span> Shift+Enter' ) select_multi_shortcut.set_alignment(0, 0.5) vbox.pack_start(select_multi_shortcut, True, True, GRID_SIZE) search_shortcut = Gtk.Label() search_shortcut.set_markup( f'<span font_weight="bold">Focus Search:</span> Ctrl+F') search_shortcut.set_alignment(0, 0.5) vbox.pack_start(search_shortcut, True, True, GRID_SIZE) next_cat_shortcut = Gtk.Label() next_cat_shortcut.set_markup( f'<span font_weight="bold">Next Emoji Category:</span> Ctrl+Tab') next_cat_shortcut.set_alignment(0, 0.5) vbox.pack_start(next_cat_shortcut, True, True, GRID_SIZE) prev_cat_shortcut = Gtk.Label() prev_cat_shortcut.set_markup( f'<span font_weight="bold">Previous Emoji Category:</span> Ctrl+Shift+Tab' ) prev_cat_shortcut.set_alignment(0, 0.5) vbox.pack_start(prev_cat_shortcut, True, True, GRID_SIZE) hbox.pack_start(vbox, True, True, GRID_SIZE) box.pack_start(hbox, True, True, GRID_SIZE) self.show_all() self.present()