gui.py 文件源码

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

项目:modis 作者: Infraxion 项目源码 文件源码
def __init__(self, parent, module_name, module_ui):
        """
        Create a new base for a module UI

        Args:
            parent: A tk or ttk object
            module_name (str): The name of the module
            module_ui: The _ui.py file to add for the module
        """

        super(ModuleUIBaseFrame, self).__init__(parent, padding=8)
        self.columnconfigure(0, weight=1)
        self.rowconfigure(1, weight=1)

        if module_ui is not None:
            # Module UI frame
            module_ui.ModuleUIFrame(self).grid(row=0, column=0, sticky="W E N S")
        else:
            logger.debug("No _ui.py found for '{}'".format(module_name))

        # Help frame
        help_frame = ttk.LabelFrame(self, padding=8, text="Help")
        help_frame.grid(row=1, column=0, sticky="W E N S")
        help_frame.columnconfigure(0, weight=1)
        help_frame.rowconfigure(0, weight=1)
        # Find the help path
        _dir = os.path.realpath(
            os.path.join(os.getcwd(), os.path.dirname(__file__)))
        help_path = "{}/modules/{}/{}".format(_dir, module_name, "_help.json")
        if os.path.isfile(help_path):
            # Load the text
            helptools.add_help_text(help_frame, help_path)
        else:
            # Default message
            tk.Label(help_frame, text="No _help.json file found for '{}'".format(module_name)).grid(row=0, column=0,
                                                                                                    sticky="W E N S")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号