當前位置: 首頁>>代碼示例>>Python>>正文


Python Panel.set_version方法代碼示例

本文整理匯總了Python中panel.Panel.set_version方法的典型用法代碼示例。如果您正苦於以下問題:Python Panel.set_version方法的具體用法?Python Panel.set_version怎麽用?Python Panel.set_version使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在panel.Panel的用法示例。


在下文中一共展示了Panel.set_version方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TrobadorPlugin

# 需要導入模塊: from panel import Panel [as 別名]
# 或者: from panel.Panel import set_version [as 別名]

#.........這裏部分代碼省略.........
        #self.proyectoEntry = Gtk.Entry()
        self.project_entry.set_text(TrobadorPlugin.project)

        version_label = Gtk.Label("Version")
        #self.version_entry = Gtk.Entry()
        self.version_entry.set_text(TrobadorPlugin.version)

        #save_button = Gtk.Button(label="Guardar")
        self.save_button.set_label("Save")
        self.save_host_button.set_label("Save")

        hostLabel = Gtk.Label("Host")

        if self.host == '':
            self.host_entry.set_text(TrobadorPlugin.default_host)
        else:
            self.host_entry.set_text(TrobadorPlugin.host)

        info_label1 = Gtk.Label("Project settings")
        info_label2 = Gtk.Label("Host settings")

        table.attach(info_label1, 0, 2, 0, 1)

        table.attach(self.check, 0, 2, 1, 2)
        table.attach(project_label, 0, 1, 2, 3)
        table.attach(self.project_entry, 1, 2, 2, 3)
        table.attach(version_label, 0, 1, 3, 4)
        table.attach(self.version_entry, 1, 2, 3, 4)
        table.attach(self.save_button, 0, 1, 4, 5)

        table.attach(info_label2, 0, 2, 5, 6)

        table.attach(hostLabel, 0, 1, 6, 7)
        table.attach(self.host_entry, 1, 2, 6, 7)
        table.attach(self.save_host_button, 0, 1, 7, 8)

        self.save_button.connect("clicked", self.save_config, self.project_entry.get_text(), self.version_entry.get_text())

        self.save_host_button.connect("clicked", self.save_host_config, self.host_entry.get_text())

        return table

    def save_config(self, save_button, project, version):
        TrobadorPlugin.project = self.project_entry.get_text()
        TrobadorPlugin.version = self.version_entry.get_text()

    def save_host_config(self, save_host_button, host):

        if self.host_entry.get_text() != '':
            TrobadorPlugin.host = self.host_entry.get_text()
        else:
            TrobadorPlugin.host = self.default_host
            self.host_entry.set_text(TrobadorPlugin.host)

    def create_panel(self):
        self.panel = Panel()
        self.panel.set_host(TrobadorPlugin.default_host)
        tree = self.panel.get_tree()
        tree.connect("row-activated", self.set_buffer)

        self.get_translation_unit

        self.handler_id = self.tab.connect("showed-message", self.get_translation_unit)

        self.panel.show()

    def set_buffer(self, tree, row, col):
        iterator = self.panel.get_iterator()
        # l = tree.get_model()
        #rootiter = l.get_iter_first()

        selection, iterator = tree.get_selection().get_selected()

        if iterator != None:
            view = self.window.get_active_view()
            if not view or not view.get_editable():
                return "no editable"

            document = view.get_buffer()
            document.begin_user_action()
            iters = document.get_selection_bounds()
            if iters:
                document.delete_interactive(iters[0], iters[1], view.get_editable())

            document.insert_interactive_at_cursor(selection.get_value(iterator, 0), -1, view.get_editable())
            document.end_user_action()

    def get_translation_unit(self, tab, msg):
        po_file = GObject.property(type=Gtranslator.Po)
        po_file = self.tab.get_po()
        print msg.get_msgid()
        msg = po_file.get_current_message()
        c = msg[0].get_msgid()
        self.panel.set_translation_unit(c)
        self.panel.set_project(self.project)
        self.panel.set_version(self.version)
        self.panel.set_host(self.host)
        print "hola: " + self.panel.get_host()
        # Updating the results
        self.panel.update_data()
開發者ID:frandieguez,項目名稱:trobador,代碼行數:104,代碼來源:trobador.py


注:本文中的panel.Panel.set_version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。