def on_button_tweet_clicked(self, button): start, end = self.text_buffer.get_bounds() status = self.text_buffer.get_text(start, end, False).decode('utf-8') account_obj = self.account_combobox.get_account_obj() account_source = self.account_combobox.get_account_source() params = {'in_reply_to_status_id': self.entry.get('id')} \ if self.entry else {} if account_source == 'Facebook': params = self.comboboxtext_privacy.get_params() if self.media.file: # update with media is_shrink = True size = 1024 upload_file = self.media.get_upload_file_obj(is_shrink, size) account_obj.api.update_with_media( status.encode('utf-8'), upload_file.name, params=params) else: # normal update account_obj.api.update(status, params=params) if not self.entry: num = self.account_combobox.combobox_account.get_active() SETTINGS.set_int('recent-account', num) self.update_window.destroy()
def on_button_tweet_clicked(self, button): start, end = self.text_buffer.get_bounds() status = self.text_buffer.get_text(start, end, False).decode('utf-8') account_obj = self.account_combobox.get_account_obj() account_source = self.account_combobox.get_account_source() params = {'in_reply_to_status_id': self.entry.get('id')} \ if self.entry else {} if account_source == 'Facebook': params = self.comboboxtext_privacy.get_params() if self.media.file: # update with media is_shrink = True size = 1024 upload_file = self.media.get_upload_file_obj(is_shrink, size) account_obj.api.update_with_media(status.encode('utf-8'), upload_file.name, params=params) else: # normal update account_obj.api.update(status, params=params) if not self.entry: num = self.account_combobox.combobox_account.get_active() SETTINGS.set_int('recent-account', num) self.update_window.destroy()
def _toggle(self, menuitem): state = menuitem.get_active() SETTINGS.set_boolean('spell-checker', state) if state: self.spellchecker.enable() else: self.spellchecker.disable()
def __init__(self, liststore): self.liststore = liststore self.gui = gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE('gfeedline.glade')) self.window = window = gui.get_object('main_window') self.column = MultiColumnDict(gui) # multi-columns for Notebooks self.theme = Theme() self.font = FontSet() self.notification = StatusNotification(liststore) dnd_list = [ Gtk.TargetEntry.new("text/uri-list", 0, 1), Gtk.TargetEntry.new("text/x-moz-url", 0, 4), ] window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_list, Gdk.DragAction.COPY) target = Gtk.TargetList.new([]) target.add(Gdk.Atom.intern("text/x-moz-url", False), 0, 4) target.add(Gdk.Atom.intern("text/uri-list", False), 0, 1) window.drag_dest_set_target_list(target) window.connect("drag-data-received", self.on_drag_data_received) SETTINGS.connect("changed::window-sticky", self.on_settings_sticky_change) self.on_settings_sticky_change(SETTINGS, 'window-sticky') SETTINGS_VIEW.connect("changed::theme", self.on_settings_theme_change) self.on_settings_theme_change(SETTINGS_VIEW, 'theme') is_multi_column = SETTINGS_VIEW.get_boolean('multi-column') menuitem_multicolumn = gui.get_object('menuitem_multicolumn') menuitem_multicolumn.set_active(is_multi_column) menuitem_update = MenuItemUpdate(gui, liststore) x, y, w, h = self._get_geometry_from_settings() # window.show() # for wrong position when auto-start if x >= 0 and y >= 0: window.move(x, y) window.resize(w, h) window.show() gui.connect_signals(self)
def __init__(self, liststore, entry=None, source=None, account=None): self.entry = entry self.child = None # for GtkGrid.get_child_at no available gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE('update.glade')) self.media = MediaFile(gui) self.config = AuthorizedTwitterAccount.CONFIG host_re = '//[A-Za-z0-9\'~+\-=_.,/%\?!;:@#\*&\(\)]+' self.http_re = re.compile("(http:%s)" % host_re) self.https_re = re.compile("(https:%s)" % host_re) self.screen_name_pattern = re.compile('\B@[0-9A-Za-z_]{1,15}') self.account_combobox = AccountCombobox( gui, liststore, source, account) is_above = SETTINGS.get_boolean('update-window-keep-above') self.update_window = gui.get_object('window1') self.update_window.set_keep_above(is_above) self.button_image = gui.get_object('button_image') self.label_num = gui.get_object('label_num') self.comboboxtext_privacy = FacebookPrivacyCombobox(gui) self.grid_button = gui.get_object('grid_button') self.on_combobox_account_changed() self.button_tweet = gui.get_object('button_tweet') self.text_buffer = gui.get_object('textbuffer') self.on_textbuffer_changed(self.text_buffer) textview = gui.get_object('textview') if SpellChecker: self.spellchecker = SpellChecker(textview) if not SETTINGS.get_boolean('spell-checker'): self.spellchecker.disable() gui.connect_signals(self) if entry: widget = 'buttonbox1' if entry.get('protected') else 'image_secret' gui.get_object(widget).hide() self._download_user_icon_with_callback(gui, entry) else: gui.get_object('grid_entry').destroy() self.update_window.present()
def __init__(self, liststore, entry=None, source=None, account=None): self.entry = entry self.child = None # for GtkGrid.get_child_at no available gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE('update.glade')) self.media = MediaFile(gui) self.config = AuthorizedTwitterAccount.CONFIG host_re = '//[A-Za-z0-9\'~+\-=_.,/%\?!;:@#\*&\(\)]+' self.http_re = re.compile("(http:%s)" % host_re) self.https_re = re.compile("(https:%s)" % host_re) self.screen_name_pattern = re.compile('\B@[0-9A-Za-z_]{1,15}') self.account_combobox = AccountCombobox(gui, liststore, source, account) is_above = SETTINGS.get_boolean('update-window-keep-above') self.update_window = gui.get_object('window1') self.update_window.set_keep_above(is_above) self.button_image = gui.get_object('button_image') self.label_num = gui.get_object('label_num') self.comboboxtext_privacy = FacebookPrivacyCombobox(gui) self.grid_button = gui.get_object('grid_button') self.on_combobox_account_changed() self.button_tweet = gui.get_object('button_tweet') self.text_buffer = gui.get_object('textbuffer') self.on_textbuffer_changed(self.text_buffer) textview = gui.get_object('textview') if SpellChecker: self.spellchecker = SpellChecker(textview) if not SETTINGS.get_boolean('spell-checker'): self.spellchecker.disable() gui.connect_signals(self) if entry: widget = 'buttonbox1' if entry.get('protected') else 'image_secret' gui.get_object(widget).hide() self._download_user_icon_with_callback(gui, entry) else: gui.get_object('grid_entry').destroy() self.update_window.present()
def start(self, widget, event): self.child = widget.get_nth_page(widget.get_current_page()).get_children()[1] # FIXBOX if SETTINGS.get_boolean("smart-tab-close"): self._set_sensitive_close_tab_menuitem() menu = self.gui.get_object("notebook_popup_menu") menu.popup(None, None, None, None, event.button, event.time)
def start(self, widget, event): self.child = widget.get_nth_page( widget.get_current_page()).get_children()[1] # FIXBOX if SETTINGS.get_boolean('smart-tab-close'): self._set_sensitive_close_tab_menuitem() menu = self.gui.get_object('notebook_popup_menu') menu.popup(None, None, None, None, event.button, event.time)
def __init__(self, liststore): self.liststore = liststore self.gui = gui = Gtk.Builder() gui.add_from_file(SHARED_DATA_FILE("gfeedline.glade")) self.window = window = gui.get_object("main_window") self.column = MultiColumnDict(gui) # multi-columns for Notebooks self.theme = Theme() self.font = FontSet() self.notification = StatusNotification(liststore) dnd_list = [Gtk.TargetEntry.new("text/uri-list", 0, 1), Gtk.TargetEntry.new("text/x-moz-url", 0, 4)] window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_list, Gdk.DragAction.COPY) target = Gtk.TargetList.new([]) target.add(Gdk.Atom.intern("text/x-moz-url", False), 0, 4) target.add(Gdk.Atom.intern("text/uri-list", False), 0, 1) window.drag_dest_set_target_list(target) window.connect("drag-data-received", self.on_drag_data_received) SETTINGS.connect("changed::window-sticky", self.on_settings_sticky_change) self.on_settings_sticky_change(SETTINGS, "window-sticky") SETTINGS_VIEW.connect("changed::theme", self.on_settings_theme_change) self.on_settings_theme_change(SETTINGS_VIEW, "theme") is_multi_column = SETTINGS_VIEW.get_boolean("multi-column") menuitem_multicolumn = gui.get_object("menuitem_multicolumn") menuitem_multicolumn.set_active(is_multi_column) menuitem_update = MenuItemUpdate(gui, liststore) x, y, w, h = self._get_geometry_from_settings() # window.show() # for wrong position when auto-start if x >= 0 and y >= 0: window.move(x, y) window.resize(w, h) window.show() gui.connect_signals(self)
def __init__(self, gui, liststore, source, account): self.account_liststore = liststore.account_liststore self.combobox_account = gui.get_object('combobox_account') self.combobox_account.set_model(self.account_liststore) if account: # for reply or retweet self.active_num = self.account_liststore.get_account_row_num( source, account) self.combobox_account.set_sensitive(False) else: recent = SETTINGS.get_int('recent-account') self.active_num = recent \ if len(self.account_liststore) > recent else 0 self.combobox_account.set_active(self.active_num)
def on_textview_populate_popup(self, textview, default_menu): if not SpellChecker: return menuitem = Gtk.CheckMenuItem.new_with_mnemonic(_('Check _Spelling')) menuitem.connect("toggled", self._toggle) is_enbled = SETTINGS.get_boolean('spell-checker') menuitem.set_active(is_enbled) if not menuitem.get_active(): separator = Gtk.SeparatorMenuItem.new() default_menu.prepend(separator) default_menu.prepend(menuitem) default_menu.show_all()