main.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:MTTT 作者: roxana-lafuente 项目源码 文件源码
def get_moses_dir(self):
        """@brief     Gets Moses directory."""
        directory = self.moses_dir
        response = Gtk.ResponseType.ACCEPT
        while response == Gtk.ResponseType.ACCEPT and not self.is_moses_dir_valid(directory):
            label = Gtk.Label("Enter MOSES installation directory")
            entry = Gtk.Entry()
            button = Gtk.Button("Choose File")
            button.connect("clicked", self._on_dir_clicked, entry)
            dialog = Gtk.Dialog("Moses configuration",
                                None,
                                Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                                (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                                 Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT))
            box = dialog.get_content_area()
            box.add(label)
            box.add(entry)
            box.add(button)
            label.show()
            entry.show()
            button.show()
            response = dialog.run()
            directory = entry.get_text()
            dialog.destroy()

        # If it is not valid, keep asking until valid or user leaves.
        if response != Gtk.ResponseType.ACCEPT:
            exit(1)
        self.moses_dir = directory

        return directory
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号