Пример #1
0
    def _delete(self, button, rfview):
        station = self._remote.get_path()

        d = inputdialog.TextInputDialog()
        d.label.set_text(_("Password for %s (blank if none):" % station))
        d.text.set_visibility(False)
        if d.run() != gtk.RESPONSE_OK:
            return
        passwd = d.text.get_text()
        d.destroy()

        fn = self._remote.get_selected_filename()

        ssel, psel = self._get_ssel()
        port = psel.get_active_text()

        def log_failure(job, state, result):
            rc = result.get("rc", "Timeout")
            event = main_events.Event(None, "%s: %s" % (job.get_dest(), rc))

            job = self._remote.refresh()
            self._emit("submit-rpc-job", job, port)
            self._emit("event", event)

        job = rpc.RPCDeleteFileJob(station, "Delete file %s" % fn)
        job.connect("state-change", log_failure)
        job.set_file(fn)
        job.set_pass(passwd)

        self.emit("submit-rpc-job", job, port)
Пример #2
0
 def _add_qm(self, button, store):
     d = inputdialog.TextInputDialog(title=_("Add Quick Message"))
     d.label.set_text(_("Enter text for the new quick message:"))
     r = d.run()
     if r == Gtk.RESPONSE_OK:
         key = time.strftime("%Y%m%d%H%M%S")
         store.append((d.text.get_text(), key))
         self._config.set("quick", key, d.text.get_text())
     d.destroy()
Пример #3
0
    def _add_filter(self, but):
        d = inputdialog.TextInputDialog(title=_("Create filter"))
        d.label.set_text(_("Enter a filter search string:"))
        r = d.run()
        text = d.text.get_text()
        d.destroy()

        if not text:
            return

        if r == Gtk.RESPONSE_OK:
            self._build_filter(text)
            self._save_filters()
Пример #4
0
    def _query_user(self, button):
        while True:
            d = inputdialog.TextInputDialog(title=_("Query User"))
            d.label.set_text(_("Enter station:"))
            r = d.run()
            text = d.text.get_text()
            d.destroy()

            if not text:
                return
            elif r != Gtk.RESPONSE_OK:
                return

            if text.startswith("@"):
                text = text[1:]

            if re.match("^[A-z0-9_-]+$", text):
                self._build_filter("@" + text.upper())
                self._save_filters()
                break

            display_error(_("Station must be a plain " +
                            "alphanumeric string"))
Пример #5
0
    def _join_channel(self, button):
        while True:
            d = inputdialog.TextInputDialog(title=_("Join Channel"))
            d.label.set_text(_("Enter channel name:"))
            r = d.run()
            text = d.text.get_text()
            d.destroy()

            if not text:
                return
            elif r != Gtk.RESPONSE_OK:
                return

            if text.startswith("#"):
                text = text[1:]

            if re.match("^[A-z0-9_-]+$", text):
                self._build_filter("#" + text)
                self._save_filters()
                break

            display_error(
                _("Channel names must be a single-word " +
                  "alphanumeric string"))