Пример #1
0
    def __init__(self):

        # inheritance
        tk.Tk.__init__(self)

        # window title
        self.wm_title("PlenoptiCam-v" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.pbar_wid = PbarWidget(self)
        self.pbar_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)
Пример #2
0
class PlenopticamApp(tk.Tk):

    REL_PATH = os.path.join('icns', '1055104.gif')

    def __init__(self):

        # inheritance
        tk.Tk.__init__(self)

        # window title
        self.wm_title("PlenoptiCam-v" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.pbar_wid = PbarWidget(self)
        self.pbar_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)

    def icon_handling(self):
        """ load icon with OS temp folder if present or current working directory instead """

        # icon path for app bundle (tmp) or non-bundled package (cwd)
        cwd = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                           self.REL_PATH)
        tmp = os.path.join(sys._MEIPASS, self.REL_PATH) if hasattr(
            sys, '_MEIPASS') else None
        fp = cwd if tmp is None else tmp

        if sys.platform == 'linux':
            # load icon on linux
            logo = tk.PhotoImage(master=self, file=fp)
            self.wm_iconphoto(True, logo)

        elif sys.platform == 'win32':
            # generate blank window icon
            _, ICON_PATH = mkstemp()
            with open(ICON_PATH, 'wb') as icon_file:
                icon_file.write(ICON)

            # load icon on Windows
            fp = fp.replace('gif', 'ico')
            fp = fp if os.path.exists(fp) else ICON_PATH
            self.iconbitmap(fp)
            self.wm_iconbitmap(default=fp)
Пример #3
0
    def __init__(self, parent):

        # inheritance
        tk.Tk.__init__(self, parent)
        self.parent = parent

        # window title
        self.wm_title("PlenoptiCam-" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()
        #self.sta.status_msg(msg='\n', opt=True)     # status message placeholder

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.view_wid = ViewWidget(self)
        self.view_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)
Пример #4
0
    def test_menu_widget(self):

        wid = MenuWidget(CtrlWidget(self.root))
        self.pump_events()
        wid.open_docs()
        wid.open_about_dialog()
        wid.destroy()
Пример #5
0
class PlenopticamApp(tk.Tk):
    def __init__(self, parent):

        # inheritance
        tk.Tk.__init__(self, parent)
        self.parent = parent

        # window title
        self.wm_title("Plenopticam-" + __version__)

        # icon handling
        if sys.platform == 'win32':
            self.wm_iconbitmap(default=ICON_PATH)
            cwd = sys._MEIPASS if hasattr(sys, '_MEIPASS') else os.getcwd()
            fp = os.path.join(cwd, 'icns', '1055104.ico')
            fp = fp if os.path.exists(fp) else ICON_PATH
            self.iconbitmap(fp)

        # initialize parameters
        self.sta = PlenopticamStatus()

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.view_wid = ViewWidget(self)
        self.view_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)

        # enable tkinter resizing
        self.resizable(True, False)
Пример #6
0
    def test_ctrl_widget(self):

        wid = CtrlWidget(self.root)

        # test path fetching
        wid.fil_wid.lfp_wid.ent.delete(0, "end")
        wid.fil_wid.cal_wid.ent.delete(0, "end")
        wid.fil_wid.lfp_wid.ent.insert(0, self.dummy_path)
        wid.fil_wid.cal_wid.ent.insert(0, self.dummy_path)
        self.cfg.params[self.cfg.lfp_path] = ''
        self.cfg.params[self.cfg.cal_path] = ''
        wid.fetch_paths()
        self.assertEqual(self.dummy_path, self.cfg.params[self.cfg.lfp_path])
        self.assertEqual(self.dummy_path, self.cfg.params[self.cfg.cal_path])

        self.pump_events()
        wid.destroy()
Пример #7
0
    def test_cmnd_widget(self):

        wid = CmndWidget(CtrlWidget(self.root))
        self.pump_events()
        wid.destroy()
Пример #8
0
class PlenopticamApp(tk.Tk):

    REL_PATH = os.path.join('icns', '1055104.gif')

    def __init__(self, parent):

        # inheritance
        tk.Tk.__init__(self, parent)
        self.parent = parent

        # window title
        self.wm_title("PlenoptiCam-" + __version__)

        # icon handling
        self.icon_handling()

        # initialize parameters
        self.sta = PlenopticamStatus()
        #self.sta.status_msg(msg='\n', opt=True)     # status message placeholder

        # instantiate controller
        self.ctrl_wid = CtrlWidget(self)
        self.ctrl_wid.pack(fill='both',
                           expand=True,
                           side='top',
                           padx=PX,
                           pady=PY)

        # instantiate view
        self.view_wid = ViewWidget(self)
        self.view_wid.pack(fill='both',
                           expand=True,
                           side='bottom',
                           padx=PX,
                           pady=PY)

    def icon_handling(self):
        ''' use OS temp folder if present or current working directory '''

        # icon path for app bundle (tmp) or non-bundled package (cwd)
        cwd = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                           self.REL_PATH)
        fp = os.path.join(sys._MEIPASS, self.REL_PATH) if hasattr(
            sys, '_MEIPASS') else cwd

        if sys.platform == 'linux':
            # load icon on linux
            logo = tk.PhotoImage(file=fp)
            self.call('wm', 'iconphoto', self._w, logo)

        elif sys.platform == 'win32':
            # generate blank window icon
            _, ICON_PATH = mkstemp()
            with open(ICON_PATH, 'wb') as icon_file:
                icon_file.write(ICON)

            # load icon on Windows
            fp = fp.replace('gif', 'ico')
            fp = ICON_PATH if not os.path.exists(fp) else fp
            self.iconbitmap(fp)
            self.wm_iconbitmap(default=fp)