示例#1
0
    def __init__(self, handle):
        """Set up the activity."""
        activity.Activity.__init__(self, handle)
        self.max_participants = 1

        self._connection = None
        self._nick_lists = {}

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        clear_all = ToolButton("clear")
        toolbar_box.toolbar.insert(clear_all, -1)
        # clear_all.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        # Start Screen, etc. starts here

        self.start_screen = StartScreen()
        self.start_screen.connect("connect-clicked", self._start)
        self.set_canvas(self.start_screen)
示例#2
0
    def __init__(self, handle):
        """Set up the activity."""
        activity.Activity.__init__(self, handle)
        self.max_participants = 1

        self._connection = None
        self._nick_lists = {}

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        clear_all = ToolButton("clear")
        toolbar_box.toolbar.insert(clear_all, -1)
        # clear_all.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        # Start Screen, etc. starts here

        self.start_screen = StartScreen()
        self.start_screen.connect("connect-clicked", self._start)
        self.set_canvas(self.start_screen)
示例#3
0
class Solari(activity.Activity):
    def __init__(self, handle):
        """Set up the activity."""
        activity.Activity.__init__(self, handle)
        self.max_participants = 1

        self._connection = None
        self._nick_lists = {}

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        clear_all = ToolButton("clear")
        toolbar_box.toolbar.insert(clear_all, -1)
        # clear_all.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        # Start Screen, etc. starts here

        self.start_screen = StartScreen()
        self.start_screen.connect("connect-clicked", self._start)
        self.set_canvas(self.start_screen)

    def _next_con(self):
        self._connection.next()
        GObject.idle_add(self._next_con)

    def connect_cb(self, cli):
        for c in self.channels:
            helpers.join(cli, c)

    def _start(self, widget, nick, server, channels, port):
        self.channels = [c.strip() for c in channels.split(",")]

        client = IRCClient(BasicHandler,
                           host=server,
                           port=port,
                           nick=nick,
                           connect_cb=self.connect_cb)
        client.get_handler().set_activity(self)

        self._connection = client.connect()
        GObject.idle_add(self._next_con)

        self.irc_widget = IRCWidget()
        self.set_canvas(self.irc_widget)

    def clean_nick(self, nick):
        return nick.split("!")[0]

    # IRC event handling starts here
    def privmsg(self, nick, channel, msg):
        nick = self.clean_nick(nick)
        self.irc_widget.add_privmsg(nick, msg)

    def joined(self, nick, channel):
        pass
示例#4
0
class Solari(activity.Activity):

    def __init__(self, handle):
        """Set up the activity."""
        activity.Activity.__init__(self, handle)
        self.max_participants = 1

        self._connection = None
        self._nick_lists = {}

        toolbar_box = ToolbarBox()

        activity_button = ActivityToolbarButton(self)
        toolbar_box.toolbar.insert(activity_button, 0)
        activity_button.show()

        clear_all = ToolButton("clear")
        toolbar_box.toolbar.insert(clear_all, -1)
        # clear_all.show()

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar_box.toolbar.insert(separator, -1)
        separator.show()

        stop_button = StopButton(self)
        toolbar_box.toolbar.insert(stop_button, -1)
        stop_button.show()

        self.set_toolbar_box(toolbar_box)
        toolbar_box.show()

        # Start Screen, etc. starts here

        self.start_screen = StartScreen()
        self.start_screen.connect("connect-clicked", self._start)
        self.set_canvas(self.start_screen)

    def _next_con(self):
        self._connection.next()
        GObject.idle_add(self._next_con)

    def connect_cb(self, cli):
        for c in self.channels:
            helpers.join(cli, c)

    def _start(self, widget, nick, server, channels, port):
        self.channels = [c.strip() for c in channels.split(",")]

        client = IRCClient(
            BasicHandler,
            host=server,
            port=port,
            nick=nick,
            connect_cb=self.connect_cb)
        client.get_handler().set_activity(self)

        self._connection = client.connect()
        GObject.idle_add(self._next_con)

        self.irc_widget = IRCWidget()
        self.set_canvas(self.irc_widget)

    def clean_nick(self, nick):
        return nick.split("!")[0]

    # IRC event handling starts here
    def privmsg(self, nick, channel, msg):
        nick = self.clean_nick(nick)
        self.irc_widget.add_privmsg(nick, msg)

    def joined(self, nick, channel):
        pass