diff options
author | Aneesh Dogra <lionaneesh@gmail.com> | 2012-12-08 18:38:41 (GMT) |
---|---|---|
committer | Aneesh Dogra <lionaneesh@gmail.com> | 2012-12-08 18:38:41 (GMT) |
commit | 9611571c56b3d39956b248cb0b48044a5adac2bf (patch) | |
tree | ce39d03b3b8e988bf568517775fa786915a33b82 | |
parent | dc1a3c8eaf5a2ab935dc862f8aaf4045ea4c1426 (diff) |
Some more fixes.
-rw-r--r-- | ircactivity.py | 2 | ||||
-rw-r--r-- | purk/scripts/notification.py | 2 | ||||
-rw-r--r-- | purk/ui.py | 27 | ||||
-rw-r--r-- | purk/widgets.py | 52 | ||||
-rw-r--r-- | purk/windows.py | 2 |
5 files changed, 43 insertions, 42 deletions
diff --git a/ircactivity.py b/ircactivity.py index 47e5510..741c25d 100644 --- a/ircactivity.py +++ b/ircactivity.py @@ -37,7 +37,7 @@ class IRCActivity(activity.Activity): logging.debug('Starting the IRC Activity') self.set_title(_('IRC Activity')) - self.add_events(Gdk.VISIBILITY_NOTIFY_MASK) + self.add_events(Gdk.EventMask.VISIBILITY_NOTIFY_MASK) self.connect('visibility-notify-event', self.__visibility_notify_event_cb) diff --git a/purk/scripts/notification.py b/purk/scripts/notification.py index c4b7c8d..a0f4d1b 100644 --- a/purk/scripts/notification.py +++ b/purk/scripts/notification.py @@ -3,7 +3,7 @@ import os import dbus -from sugar.activity import activity +from sugar3.activity import activity session_bus = dbus.SessionBus() @@ -2,10 +2,11 @@ import sys import os import thread -import gobject +from gi.repository import GObject __sys_path = list(sys.path) -import gtk +from gi.repository import Gtk +from gi.repository import Gdk sys.path = __sys_path import widgets @@ -21,16 +22,16 @@ def path(filename=""): return urkpath # Priority Constants -PRIORITY_HIGH = gobject.PRIORITY_HIGH -PRIORITY_DEFAULT = gobject.PRIORITY_DEFAULT -PRIORITY_HIGH_IDLE = gobject.PRIORITY_HIGH_IDLE -PRIORITY_DEFAULT_IDLE = gobject.PRIORITY_DEFAULT_IDLE -PRIORITY_LOW = gobject.PRIORITY_LOW +PRIORITY_HIGH = GObject.PRIORITY_HIGH +PRIORITY_DEFAULT = GObject.PRIORITY_DEFAULT +PRIORITY_HIGH_IDLE = GObject.PRIORITY_HIGH_IDLE +PRIORITY_DEFAULT_IDLE = GObject.PRIORITY_DEFAULT_IDLE +PRIORITY_LOW = GObject.PRIORITY_LOW def set_clipboard(text): - gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD).set_text(text) - gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY).set_text(text) + Gtk.clipboard_get(Gdk.SELECTION_CLIPBOARD).set_text(text) + Gtk.clipboard_get(Gdk.SELECTION_PRIMARY).set_text(text) class Source(object): __slots__ = ['enabled'] @@ -50,13 +51,13 @@ def register_idle(f, *args, **kwargs): priority = kwargs.pop("priority",PRIORITY_DEFAULT_IDLE) def callback(): return f(*args, **kwargs) - return GtkSource(gobject.idle_add(callback, priority=priority)) + return GtkSource(GObject.idle_add(callback, priority=priority)) def register_timer(time, f, *args, **kwargs): priority = kwargs.pop("priority",PRIORITY_DEFAULT_IDLE) def callback(): return f(*args, **kwargs) - return GtkSource(gobject.timeout_add(time, callback, priority=priority)) + return GtkSource(GObject.timeout_add(time, callback, priority=priority)) def fork(cb, f, *args, **kwargs): is_stopped = Source() @@ -71,7 +72,7 @@ def fork(cb, f, *args, **kwargs): if is_stopped.enabled: cb(result, error) - gobject.idle_add(callback) + GObject.idle_add(callback) thread.start_new_thread(thread_func, ()) return is_stopped @@ -79,7 +80,7 @@ def fork(cb, f, *args, **kwargs): set_style = widgets.set_style def we_get_signal(*what): - gobject.idle_add(windows.manager.exit) + GObject.idle_add(windows.manager.exit) def open_file(path): pass diff --git a/purk/widgets.py b/purk/widgets.py index abbaddc..a9b6621 100644 --- a/purk/widgets.py +++ b/purk/widgets.py @@ -1,6 +1,6 @@ import codecs -import gobject +from gi.repository import GObject from gi.repository import Gtk from gi.repository import Gdk from gi.repository import Pango @@ -25,10 +25,10 @@ ACTIVITY_MARKUP = { # This holds all tags for all windows ever tag_table = Gtk.TextTagTable() -link_tag = Gtk.TextTag('link') -link_tag.set_property('underline', pango.UNDERLINE_SINGLE) +link_tag = Gtk.TextTag.new('link') +link_tag.set_property('underline', Pango.Underline.SINGLE) -indent_tag = Gtk.TextTag('indent') +indent_tag = Gtk.TextTag.new('indent') indent_tag.set_property('indent', -20) tag_table.add(link_tag) @@ -53,7 +53,7 @@ def set_style(widget_name, style): dummy.modify_base(Gtk.StateType.NORMAL, Gdk.color.parse(value)) def apply_style_font(value): - dummy.modify_font(pango.FontDescription(value)) + dummy.modify_font(Pango.FontDescription(value)) style_functions = ( ('fg', apply_style_fg), @@ -339,14 +339,14 @@ class TextInput(Gtk.Entry): self.connect('activate', TextInput.entered_text, False) -gobject.type_register(TextInput) +GObject.type_register(TextInput) -def prop_to_gtk(textview, (prop, val)): +def prop_to_Gtk(textview, (prop, val)): if val == parse_mirc.BOLD: - val = pango.WEIGHT_BOLD + val = Pango.WEIGHT_BOLD elif val == parse_mirc.UNDERLINE: - val = pango.UNDERLINE_SINGLE + val = Pango.Underline.SINGLE return {prop: val} @@ -466,7 +466,7 @@ class TextOutput(Gtk.TextView): tag_name = str(tag['data']) if not tag_table.lookup(tag_name): - buffer.create_tag(tag_name, **prop_to_gtk(self, tag['data'])) + buffer.create_tag(tag_name, **prop_to_Gtk(self, tag['data'])) buffer.apply_tag_by_name( tag_name, @@ -573,26 +573,26 @@ class TextOutput(Gtk.TextView): self._scrolling = False if not self._scrolling: - self._scrolling = gobject.idle_add(do_scroll) + self._scrolling = GObject.idle_add(do_scroll) def check_autoscroll(self, *args): def set_to_scroll(): self.autoscroll = self.scroller.value + self.scroller.page_size >= self.scroller.upper - gobject.idle_add(set_to_scroll) + GObject.idle_add(set_to_scroll) def __init__(self, core, window, buffer=None): if not buffer: - buffer = Gtk.TextBuffer(tag_table) + buffer = Gtk.TextBuffer.new(tag_table) - Gtk.TextView.__init__(self, buffer) + Gtk.TextView.__init__(buffer) self.core = core self.events = core.events self.win = window self.set_size_request(0, -1) - self.set_wrap_mode(Gtk.WRAP_WORD_CHAR) + self.set_wrap_mode(Gtk.WrapMode.WORD_CHAR) self.set_editable(False) self.set_cursor_visible(False) @@ -604,12 +604,12 @@ class TextOutput(Gtk.TextView): self.add_events(Gdk.POINTER_MOTION_HINT_MASK) self.add_events(Gdk.LEAVE_NOTIFY_MASK) - self.connect('populate-popup', TextOutput.popup) - self.connect('motion-notify-event', TextOutput.hover) - self.connect('button-press-event', TextOutput.mousedown) - self.connect('button-release-event', TextOutput.mouseup) + self.connect('populate-popup', self.popup) + self.connect('motion-notify-event', self.hover) + self.connect('button-press-event', self.mousedown) + self.connect('button-release-event', self.mouseup) self.connect_after('button-release-event', lambda *a: True) - self.connect('leave-notify-event', TextOutput.clear_hover) + self.connect('leave-notify-event', self.clear_hover) self.hover_coords = 0, 0 @@ -627,7 +627,7 @@ class TextOutput(Gtk.TextView): vadj.connect("value-changed", set_scroll) self.connect("set-scroll-adjustments", setup_scroll) - self.connect("size-allocate", TextOutput.scroll) + self.connect("size-allocate", self.scroll) def set_cursor(widget): self.get_window(Gtk.TEXT_WINDOW_TEXT).set_cursor(None) @@ -680,7 +680,7 @@ class WindowLabel(Gtk.EventBox): self.update() self.show_all() -class FindBox(gtk.HBox): +class FindBox(Gtk.HBox): def remove(self, *args): self.parent.remove(self) self.win.focus() @@ -731,8 +731,8 @@ class FindBox(gtk.HBox): self.win = window - self.up = Gtk.Button(stock='gtk-go-up') - self.down = Gtk.Button(stock='gtk-go-down') + self.up = Gtk.Button(stock='Gtk-go-up') + self.down = Gtk.Button(stock='Gtk-go-down') self.up.connect('clicked', self.clicked) self.down.connect('clicked', self.clicked, True) @@ -764,12 +764,12 @@ class UrkUITabs(Gtk.VBox): self.tabs = Notebook() self.tabs.set_property( "tab-pos", - conf.get("ui-gtk/tab-pos", Gtk.POS_BOTTOM) + conf.get("ui-Gtk/tab-pos", Gtk.PositionType.BOTTOM) ) self.tabs.set_scrollable(True) self.tabs.set_property("can-focus", False) - self.pack_end(self.tabs) + self.pack_end(self.tabs, False, True, 0) def __iter__(self): return iter(self.tabs.get_children()) diff --git a/purk/windows.py b/purk/windows.py index 6ec45e6..9301a86 100644 --- a/purk/windows.py +++ b/purk/windows.py @@ -163,7 +163,7 @@ class SimpleWindow(Window): self.pack_end(self.input, expand=False) topbox = Gtk.ScrolledWindow() - topbox.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) + topbox.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) topbox.add(self.output) self.pack_end(topbox) |