コード例 #1
0
    def deselected(self):
        MainWindowTab.deselected(self)

        make_invisible = ["main_menu_importmsg", "main_menu_exportmsg"]

        for name in make_invisible:
            item = self._wtree.get_widget(name)
            item.set_property("visible", False)
コード例 #2
0
ファイル: main_chat.py プロジェクト: jondkelley/d-rats3k
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "chat")

        entry, send, dest = self._getw("entry", "send", "destination")
        self.__filtertabs, = self._getw("filtertabs")
        self.__filters = {}

        self.__filtertabs.remove_page(0)
        self.__filtertabs.connect("switch-page", self._tab_selected)
        self.__filtertabs.connect("page-reordered", self._tab_reordered)

        self.__tb_buttons = {}

        addf = self._wtree.get_widget("main_menu_addfilter")
        addf.connect("activate", self._add_filter)

        delf = self._wtree.get_widget("main_menu_delfilter")
        delf.connect("activate", self._del_filter)

        vlog = self._wtree.get_widget("main_menu_viewlog")
        vlog.connect("activate", self._view_log)

        send.connect("clicked", self._send_button, dest, entry)
        send.set_flags(Gtk.CAN_DEFAULT)
        send.connect("expose-event", lambda w, e: w.grab_default())

        if self._config.getboolean("prefs", "check_spelling"):
            spell.prepare_TextBuffer(entry.get_buffer())

        entry.set_wrap_mode(Gtk.WRAP_WORD)
        entry.connect("key-press-event", self._enter_to_send, dest)
        entry.grab_focus()

        self._qm = ChatQM(wtree, config)
        self._qst = ChatQST(wtree, config)
        self._qm.connect("user-sent-qm", self._send_msg, False, dest)
        self._qst.connect("qst-fired", self._send_msg, dest)

        self._last_date = 0

        bcast = self._wtree.get_widget("main_menu_bcast")
        bcast.connect("activate", self._bcast_file, dest)

        clear = self._wtree.get_widget("main_menu_clear")
        clear.connect("activate", self._clear)

        try:
            dest.set_tooltip_text(
                _("Choose the port where chat " +
                  "and QST messages will be sent"))
        except AttributeError:
            # Old PyGTK doesn't have this
            pass

        self._init_toolbar()

        self.reconfigure()
コード例 #3
0
ファイル: main_chat.py プロジェクト: jondkelley/d-rats3k
    def deselected(self):
        MainWindowTab.deselected(self)

        make_invisible = [
            "main_menu_bcast", "main_menu_clear", "main_menu_addfilter",
            "main_menu_delfilter", "main_menu_viewlog"
        ]

        for name in make_invisible:
            item = self._wtree.get_widget(name)
            item.set_property("visible", False)
コード例 #4
0
ファイル: main_chat.py プロジェクト: jondkelley/d-rats3k
    def selected(self):
        MainWindowTab.selected(self)

        make_visible = [
            "main_menu_bcast", "main_menu_clear", "main_menu_addfilter",
            "main_menu_delfilter", "main_menu_viewlog"
        ]

        for name in make_visible:
            item = self._wtree.get_widget(name)
            item.set_property("visible", True)

        entry, = self._getw("entry")
        gobject.idle_add(entry.grab_focus)
コード例 #5
0
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "msg")

        self._init_toolbar()
        self._folders = MessageFolders(wtree, config)
        self._messages = MessageList(wtree, config)
        self._messages.connect("prompt-send-form", self._snd_msg)
        self._messages.connect("reply-form", self._rpl_msg)
        self._messages.connect("delete-form", self._del_msg)

        self._folders.connect("user-selected-folder",
                              lambda x, y: self._messages.open_folder(y))
        self._folders.select_folder(_("Inbox"))

        iport = self._wtree.get_widget("main_menu_importmsg")
        iport.connect("activate", self._importmsg)

        eport = self._wtree.get_widget("main_menu_exportmsg")
        eport.connect("activate", self._exportmsg)
コード例 #6
0
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "files")

        lview, rview = self._getw("local_list", "remote_list")

        self._setup_file_view(lview)
        self._setup_file_view(rview)

        stations, = self._getw("sel_station")
        utils.set_entry_hint(stations.child, REMOTE_HINT)

        ddir = self._config.get("prefs", "download_dir")

        self._local = LocalFileView(lview, None, self._config)

        self._remote = None
        rview.set_sensitive(False)

        self._init_toolbar()
        self._stop_throb()

        self.__selected = False

        self.reconfigure()
コード例 #7
0
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "files")

        lview, rview = self._getw("local_list", "remote_list")

        self._setup_file_view(lview)
        self._setup_file_view(rview)

        stations, = self._getw("sel_station")
        utils.set_entry_hint(stations.child, REMOTE_HINT)

        ddir = self._config.get("prefs", "download_dir")

        self._local = LocalFileView(lview, None, self._config)

        self._remote = None
        rview.set_sensitive(False)

        self._init_toolbar()
        self._stop_throb()

        self.__selected = False

        self.reconfigure()
コード例 #8
0
 def deselected(self):
     MainWindowTab.deselected(self)
     self.__selected = False
コード例 #9
0
 def selected(self):
     MainWindowTab.selected(self)
     self.__selected = True
     ssel, psel = self._get_ssel()
     self._refresh_calls(ssel, psel)
     gobject.timeout_add(1000, self._refresh_calls, ssel, psel)
コード例 #10
0
 def deselected(self):
     MainWindowTab.deselected(self)
     self.__selected = False
コード例 #11
0
 def selected(self):
     MainWindowTab.selected(self)
     self.__selected = True
     ssel, psel = self._get_ssel()
     self._refresh_calls(ssel, psel)
     gobject.timeout_add(1000, self._refresh_calls, ssel, psel)
コード例 #12
0
ファイル: main_events.py プロジェクト: yanicky/d-rats
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "event")

        self.__ctr = 0

        eventlist, = self._getw("list")

        eventlist.connect("button_press_event", self._mouse_cb)

        self.store = gtk.ListStore(
            gobject.TYPE_STRING,  # 0: id
            gobject.TYPE_OBJECT,  # 1: icon
            gobject.TYPE_INT,  # 2: timestamp
            gobject.TYPE_STRING,  # 3: message
            gobject.TYPE_STRING,  # 4: details
            gobject.TYPE_INT,  # 5: order
            gobject.TYPE_PYOBJECT,  # 6: event
        )
        self._filter_icon = None
        filter = self.store.filter_new()
        filter.set_visible_func(filter_rows, self)
        eventlist.set_model(filter)

        col = gtk.TreeViewColumn("", gtk.CellRendererPixbuf(), pixbuf=1)
        eventlist.append_column(col)

        def render_time(col, rend, model, iter):
            val, = model.get(iter, 2)
            stamp = datetime.fromtimestamp(val)
            rend.set_property("text", stamp.strftime("%Y-%m-%d %H:%M:%S"))

        r = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Time"), r, text=2)
        col.set_cell_data_func(r, render_time)
        col.set_sort_column_id(5)
        col.connect("clicked", self.__change_sort)
        eventlist.append_column(col)

        try:
            srt = int(self._config.get("state", "events_sort"))
        except ValueError:
            srt = gtk.SORT_DESCENDING
        self.store.set_sort_column_id(5, srt)
        col.set_sort_indicator(True)
        col.set_sort_order(srt)

        r = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Description"), r, text=3)
        eventlist.append_column(col)

        typesel, = self._getw("typesel")
        typesel.set_active(0)
        typesel.connect("changed", self._type_selected, filter)

        filtertext, = self._getw("searchtext")
        filtertext.connect("changed", self._search_text, filter)
        utils.set_entry_hint(filtertext, FILTER_HINT)

        self._load_pixbufs()

        event = Event(None, _("D-RATS Started"))
        self.event(event)
コード例 #13
0
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "main")

        frame, self.__view, = self._getw("stations_frame", "stations_view")

        store = Gtk.ListStore(
            gobject.TYPE_STRING,  # Station
            gobject.TYPE_INT,  # Timestamp
            gobject.TYPE_STRING,  # Message
            gobject.TYPE_INT,  # Status
            gobject.TYPE_STRING,  # Status message
            gobject.TYPE_STRING)  # Port
        store.set_sort_column_id(1, Gtk.SORT_DESCENDING)
        self.__view.set_model(store)

        try:
            self.__view.set_tooltip_column(2)
        except AttributeError:
            print("This version of GTK is old; disabling station tooltips")

        self.__view.connect("button_press_event", self._mouse_cb)

        def render_call(col, rend, model, iter):
            call, ts, status = model.get(iter, 0, 1, 3)
            sec = time.time() - ts

            hour = 3600
            day = (hour * 24)

            if sec < 60:
                msg = call
            elif sec < hour:
                msg = "%s (%im)" % (call, (sec / 60))
            elif sec < day:
                msg = "%s (%ih %im)" % (call, sec / 3600, (sec % 3600) / 60)
            else:
                msg = "%s (%id %ih)" % (call, sec / day, (sec % day) / 3600)

            if status == station_status.STATUS_ONLINE:
                color = "blue"
            elif status == station_status.STATUS_UNATTENDED:
                color = "#CC9900"
            elif status == station_status.STATUS_OFFLINE:
                color = "grey"
            else:
                color = "black"

            rend.set_property("markup",
                              "<span color='%s'>%s</span>" % (color, msg))

        r = Gtk.CellRendererText()
        col = Gtk.TreeViewColumn(_("Stations"), r, text=0)
        col.set_cell_data_func(r, render_call)
        self.__view.append_column(col)

        self.__calls = []
        self._update_station_count()

        status, msg = self._getw("stations_status", "stations_smsg")

        try:
            status.set_tooltip_text(
                _("This is the state other stations will " +
                  "see when requesting your status"))
            msg.set_tooltip_text(
                _("This is the message other stations will " +
                  "see when requesting your status"))
        except AttributeError:
            pass

        def set_status(cb):
            self.__status = cb.get_active_text()
            self._config.set("state", "status_state", self.__status)

        def set_smsg(e):
            self.__smsg = e.get_text()
            self._config.set("state", "status_msg", self.__smsg)

        for s in sorted(station_status.get_status_msgs().values()):
            if s not in [_("Unknown"), _("Offline")]:
                status.append_text(s)

        status.connect("changed", set_status)
        msg.connect("changed", set_smsg)

        prev_status = self._config.get("state", "status_state")
        if not utils.combo_select(status, prev_status):
            utils.combo_select(
                status,
                list(station_status.get_status_msgs().values())[0])
        msg.set_text(self._config.get("state", "status_msg"))
        set_status(status)
        set_smsg(msg)

        gobject.timeout_add(30000, self._update)
コード例 #14
0
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "main")

        frame, self.__view, = self._getw("stations_frame", "stations_view")

        store = gtk.ListStore(gobject.TYPE_STRING,  # Station
                              gobject.TYPE_INT,     # Timestamp
                              gobject.TYPE_STRING,  # Message
                              gobject.TYPE_INT,     # Status
                              gobject.TYPE_STRING,  # Status message
                              gobject.TYPE_STRING)  # Port
        store.set_sort_column_id(1, gtk.SORT_DESCENDING)
        self.__view.set_model(store)

        try:
            self.__view.set_tooltip_column(2)
        except AttributeError:
            print "This version of GTK is old; disabling station tooltips"

        self.__view.connect("button_press_event", self._mouse_cb)

        def render_call(col, rend, model, iter):
            call, ts, status = model.get(iter, 0, 1, 3)
            sec = time.time() - ts

            hour = 3600
            day = (hour*24)

            if sec < 60:
                msg = call
            elif sec < hour:
                msg = "%s (%im)" % (call, (sec / 60))
            elif sec < day:
                msg = "%s (%ih %im)" % (call, sec / 3600, (sec % 3600) / 60)
            else:
                msg = "%s (%id %ih)" % (call, sec / day, (sec % day) / 3600)

            if status == station_status.STATUS_ONLINE:
                color = "blue"
            elif status == station_status.STATUS_UNATTENDED:
                color = "#CC9900"
            elif status == station_status.STATUS_OFFLINE:
                color = "grey"
            else:
                color = "black"

            rend.set_property("markup", "<span color='%s'>%s</span>" % (color,
                                                                        msg))

        r = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Stations"), r, text=0)
        col.set_cell_data_func(r, render_call)
        self.__view.append_column(col)

        self.__calls = []
        self._update_station_count()

        status, msg = self._getw("stations_status", "stations_smsg")

        try:
            status.set_tooltip_text(_("This is the state other stations will " +
                                      "see when requesting your status"))
            msg.set_tooltip_text(_("This is the message other stations will " +
                                   "see when requesting your status"))
        except AttributeError:
            pass

        def set_status(cb):
            self.__status = cb.get_active_text()
            self._config.set("state", "status_state", self.__status)

        def set_smsg(e):
            self.__smsg = e.get_text()
            self._config.set("state", "status_msg", self.__smsg)

        for s in sorted(station_status.get_status_msgs().values()):
            if s not in [_("Unknown"), _("Offline")]:
                status.append_text(s)

        status.connect("changed", set_status)
        msg.connect("changed", set_smsg)

        prev_status = self._config.get("state", "status_state")
        if not utils.combo_select(status, prev_status):
            utils.combo_select(status,
                               station_status.get_status_msgs().values()[0])
        msg.set_text(self._config.get("state", "status_msg"))
        set_status(status)
        set_smsg(msg)

        gobject.timeout_add(30000, self._update)
コード例 #15
0
ファイル: main_events.py プロジェクト: coddingtonbear/d-rats
    def __init__(self, wtree, config):
        MainWindowTab.__init__(self, wtree, config, "event")

        self.__ctr = 0

        eventlist, = self._getw("list")

        eventlist.connect("button_press_event", self._mouse_cb)

        self.store = gtk.ListStore(gobject.TYPE_STRING,  # 0: id
                                   gobject.TYPE_OBJECT,  # 1: icon
                                   gobject.TYPE_INT,     # 2: timestamp
                                   gobject.TYPE_STRING,  # 3: message
                                   gobject.TYPE_STRING,  # 4: details
                                   gobject.TYPE_INT,     # 5: order
                                   gobject.TYPE_PYOBJECT,# 6: event
                                   )
        self._filter_icon = None
        filter = self.store.filter_new()
        filter.set_visible_func(filter_rows, self)
        eventlist.set_model(filter)

        col = gtk.TreeViewColumn("", gtk.CellRendererPixbuf(), pixbuf=1)
        eventlist.append_column(col)

        def render_time(col, rend, model, iter):
            val, = model.get(iter, 2)
            stamp = datetime.fromtimestamp(val)
            rend.set_property("text", stamp.strftime("%Y-%m-%d %H:%M:%S"))

        r = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Time"), r, text=2)
        col.set_cell_data_func(r, render_time)
        col.set_sort_column_id(5)
        col.connect("clicked", self.__change_sort)
        eventlist.append_column(col)

        try:
            srt = int(self._config.get("state", "events_sort"))
        except ValueError:
            srt = gtk.SORT_DESCENDING
        self.store.set_sort_column_id(5, srt)
        col.set_sort_indicator(True)
        col.set_sort_order(srt)

        r = gtk.CellRendererText()
        col = gtk.TreeViewColumn(_("Description"), r, text=3)
        eventlist.append_column(col)

        typesel, = self._getw("typesel")
        typesel.set_active(0)
        typesel.connect("changed", self._type_selected, filter)

        filtertext, = self._getw("searchtext")
        filtertext.connect("changed", self._search_text, filter)
        utils.set_entry_hint(filtertext, FILTER_HINT)

        self._load_pixbufs()

        event = Event(None, _("D-RATS Started"))
        self.event(event)