diff options
author | Eduardo Silva <edsiper@gmail.com> | 2007-11-13 13:43:38 (GMT) |
---|---|---|
committer | Eduardo Silva <edsiper@gmail.com> | 2007-11-13 13:43:38 (GMT) |
commit | 4b1c3cc5901e0e612c1d784b8c52656fa76fd15b (patch) | |
tree | e219c807cad984430e13377ab8b107cdda3972c9 | |
parent | 65c7931d99ad8cce375e696f6be82c7e1acb34a8 (diff) |
Fix joining extra servers/channels
-rw-r--r-- | purk/__init__.py | 3 | ||||
-rw-r--r-- | purk/irc.py | 6 | ||||
-rw-r--r-- | purk/scripts/keys.py | 2 | ||||
-rw-r--r-- | purk/scripts/ui_script.py | 7 | ||||
-rw-r--r-- | purk/widgets.py | 3 | ||||
-rw-r--r-- | purk/windows.py | 30 |
6 files changed, 17 insertions, 34 deletions
diff --git a/purk/__init__.py b/purk/__init__.py index 8891927..b398dfb 100644 --- a/purk/__init__.py +++ b/purk/__init__.py @@ -5,7 +5,7 @@ import events import windows urkpath = os.path.abspath(os.path.dirname(__file__)) -print urkpath + if os.path.abspath(os.curdir) != os.path.join(urkpath): sys.path[0] = os.path.join(urkpath) @@ -97,6 +97,7 @@ class Client(object): self.widget.show_all() def add_channel(self, channel): + print "Add channel: ", channel self.core.channels.append(channel) def clear_channels(self): diff --git a/purk/irc.py b/purk/irc.py index 48d1fb8..e88e43a 100644 --- a/purk/irc.py +++ b/purk/irc.py @@ -158,7 +158,7 @@ class Network(object): self.source = source = ui.Source() self.buffer = (self.buffer + result).split("\r\n") - + for line in self.buffer[:-1]: self.got_msg(line) @@ -178,13 +178,13 @@ class Network(object): def got_msg(self, msg): pmsg = parse_irc(msg, self.server) - + e_data = self.events.data( raw=msg, msg=pmsg, text=pmsg[-1], network=self, - window=windows.get_default(self, self.manager) + window=windows.get_default(self, self.core.manager) ) if "!" in pmsg[0]: diff --git a/purk/scripts/keys.py b/purk/scripts/keys.py index e26572c..98b3736 100644 --- a/purk/scripts/keys.py +++ b/purk/scripts/keys.py @@ -49,7 +49,7 @@ def onKeyPress(e): # tabbed browsing elif e.key == '^t': - windows.new(windows.StatusWindow, irc.Network(), 'status').activate() + windows.new(windows.StatusWindow, irc.Network(core), 'status',core).activate() elif e.key == '^w': windows.manager.get_active().close() diff --git a/purk/scripts/ui_script.py b/purk/scripts/ui_script.py index 459de96..1d2a4f3 100644 --- a/purk/scripts/ui_script.py +++ b/purk/scripts/ui_script.py @@ -26,12 +26,7 @@ def onExit(e): def setupJoin(e): if e.source == e.network.me: - window = windows.get(windows.StatusWindow, e.network, 'status', core) - - if window and not conf.get('status'): - window.mutate(windows.ChannelWindow, e.network, e.target) - else: - window = windows.new(windows.ChannelWindow, e.network, e.target, core) + window = windows.new(windows.ChannelWindow, e.network, e.target, core) if e.requested: window.activate() diff --git a/purk/widgets.py b/purk/widgets.py index e44a936..f2476ef 100644 --- a/purk/widgets.py +++ b/purk/widgets.py @@ -769,9 +769,8 @@ class UrkUITabs(gtk.VBox): self.tabs.set_scrollable(True) self.tabs.set_property("can-focus", False) - self.pack_end(self.tabs) - + def __iter__(self): return iter(self.tabs.get_children()) diff --git a/purk/windows.py b/purk/windows.py index 22c783a..7a20187 100644 --- a/purk/windows.py +++ b/purk/windows.py @@ -5,16 +5,17 @@ from conf import conf import widgets #manager = widgets.UrkUITabs() - def append(window, manager): + print "** DEBUG :: Add Window: ", window manager.add(window) def remove(window, manager): + print "** DEBUG :: Remove Window: ", window manager.remove(window) - + # i don't want to have to call this window.destroy() - + def new(wclass, network, id, core): if network is None: network = irc.dummy_network @@ -25,7 +26,7 @@ def new(wclass, network, id, core): append(w, core.manager) return w - + def get(windowclass, network, id, core): if network: id = network.norm_case(id) @@ -33,7 +34,7 @@ def get(windowclass, network, id, core): for w in core.manager: if (type(w), w.network, w.id) == (windowclass, network, id): return w - + def get_with(manager, wclass=None, network=None, id=None): if network and id: id = network.norm_case(id) @@ -47,31 +48,18 @@ def get_with(manager, wclass=None, network=None, id=None): yield w def get_default(network, manager): - window = manager.get_active() + if window.network == network: return window # There can be only one... - for window in get_with(network=network): + for window in get_with(manager, None, network): return window class Window(gtk.VBox): need_vbox_init = True - - def mutate(self, newclass, network, id): - isactive = self == manager.get_active() - self.hide() - - for child in self.get_children(): - self.remove(child) - self.__class__ = newclass - self.__init__(network, id) - self.update() - if isactive: - self.activate() - def transfer_text(self, _widget, event): if event.string and not self.input.is_focus(): self.input.grab_focus() @@ -261,6 +249,7 @@ def drop_nicklist(paned, event): class ChannelWindow(Window): def __init__(self, network, id, core): Window.__init__(self, network, id, core) + print "** DEBUG :: NEW Channel Window: ", network, ", ", id, ", ", core self.nicklist = widgets.Nicklist(self, core) self.nick_label = widgets.NickEditor(self, core) @@ -294,5 +283,4 @@ class ChannelWindow(Window): pane.connect("button-release-event", drop_nicklist) self.pack_end(pane) - self.show_all() |