当前位置: 首页>>代码示例>>Python>>正文


Python Panel.get_host方法代码示例

本文整理汇总了Python中panel.Panel.get_host方法的典型用法代码示例。如果您正苦于以下问题:Python Panel.get_host方法的具体用法?Python Panel.get_host怎么用?Python Panel.get_host使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在panel.Panel的用法示例。


在下文中一共展示了Panel.get_host方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TrobadorPlugin

# 需要导入模块: from panel import Panel [as 别名]
# 或者: from panel.Panel import get_host [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.get_host方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。