How to use the plenopticam.gui.constants.PY function in plenopticam

To help you get started, we’ve selected a few plenopticam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hahnec / plenopticam / tests / unit_test_gui.py View on Github external
def test_pbar_widget(self):

        self.root.sta = self.sta
        wid = PbarWidget(self.root)
        wid.pack(fill='both', expand=True, side='bottom', padx=PX, pady=PY)

        proc_name = 'Test'
        wid.update_stat_msg(proc_name)
        self.assertEqual(proc_name, wid.tk_stat.__getitem__('text'))

        exp_val = 50
        wid.update_prog_bar(exp_val)
        self.assertEqual(exp_val, wid.tk_prog_bar['value'])

        exp_val = 0
        wid.update_prog_msg(exp_val)
        self.assertEqual(str(exp_val)+' %', wid.s.configure("LabeledProgressbar", 'text').strip())

        exp_val = '1'
        wid.update_prog_msg(exp_val)
        self.assertEqual(exp_val, wid.s.configure("LabeledProgressbar", 'text').strip())
github hahnec / plenopticam / plenopticam / gui / widget_ctrl.py View on Github external
self.parent = parent

        # instantiate status
        self.sta = parent.sta
        self.sta.bind_to_interrupt(self.stop_thread)

        # instantiate config settings
        self.cfg = parent.cfg if hasattr(parent, 'cfg') else PlenopticamConfig()

        # instantiate menu widget
        self.men_wid = MenuWidget(self)
        self.men_wid.grid()

        # instantiate config widget
        self.fil_wid = FileWidget(self)
        self.fil_wid.grid(padx=PX, pady=PY)

        # instantiate command widget
        self.cmd_wid = CmndWidget(self)
        self.cmd_wid.grid(padx=PX, pady=PY)

        self.all_btn_list = self.fil_wid.btn_list + self.men_wid.btn_list + self.cmd_wid.btn_list[:2]

        self.var_init()
github hahnec / plenopticam / plenopticam / gui / widget_file.py View on Github external
('All files', ' '.join(ALL_EXTS+[x.upper() for x in ALL_EXTS]))]
        CAL_EXTS = [('Supported files', ' '.join(merge_cal_exts+[x.upper() for x in merge_cal_exts])),
                    ('Lytro files', ' '.join(LYT_CAL_EXTS+[x.upper() for x in lyt_cal_exts])),
                    ('Generic image files', ' '.join(generic_exts+[x.upper() for x in generic_exts])),
                    ('All files', ' '.join(ALL_EXTS+[x.upper() for x in ALL_EXTS]))]

        # instantiate light field path widget
        tk.Label(self, text='Light field image: ').grid(row=0, column=0, sticky='W')
        self.lfp_wid = PathWidget(self, path=self.cfg.params[self.cfg.lfp_path], path_type=False, file_exts=LFP_EXTS)
        self.lfp_wid.grid(row=0, column=1, padx=PX, pady=PY)
        self.lfp_wid.bind_to(self.set_lfp_path)     # observe change in path variable

        # instantiate calibration path widget
        tk.Label(self, text='Calibration source: ').grid(row=1, column=0, sticky='W')
        self.cal_wid = PathWidget(self, path=self.cfg.params[self.cfg.cal_path], path_type=False, file_exts=CAL_EXTS)
        self.cal_wid.grid(row=1, column=1, padx=PX, pady=PY)
        self.cal_wid.bind_to(self.set_cal_path)     # observe change in path variable

        # radio button to enable change from path to file type
        self.cal_wid.path_type = os.path.isdir(self.cfg.params[self.cfg.cal_path])
        self.chk_var = tk.BooleanVar(value=bool(self.cal_wid.path_type))
        self.chk_btn = tk.Checkbutton(self, text='Pick folder', variable=self.chk_var, command=self.btn_update)
        self.chk_btn.grid(row=1, column=2, sticky='W')

        # list of button and entry widgets (collected to disable/enable widgets)
        self.btn_list = [self.lfp_wid.btn, self.cal_wid.btn, self.chk_btn, self.lfp_wid.ent, self.cal_wid.ent]
github hahnec / plenopticam / plenopticam / gui / top_level.py View on Github external
# 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)
github hahnec / plenopticam / plenopticam / gui / widget_about.py View on Github external
def __init__(self):

        # open about window
        self.abt_widget = tk.Toplevel(padx=PX, pady=PY)

        # window title
        self.abt_widget.wm_title("About")

        # name and version
        line = tk.Label(master=self.abt_widget, text="Plenopticam "+__version__)
        line.grid(row=0, padx=PX, pady=PY, sticky='NWSE')

        # website
        link = tk.Label(master=self.abt_widget, text=r"http://www.plenoptic.info")
        link.grid(row=1, padx=PX, pady=PY, sticky='NWSE')

        # license
        license = tk.Label(master=self.abt_widget, text=__license__)
        license.grid(row=2, padx=PX, sticky='NWSE')
github hahnec / plenopticam / plenopticam / gui / widget_cmnd.py View on Github external
def __init__(self, parent):

        # inheritance
        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.cfg = parent.cfg
        self.btn_list = []

        # button for light field processing
        run_btn = tk.Button(self, text='Process', width=BTN_W, command=self.parent.process)
        run_btn.grid(row=0, column=0, padx=PX, pady=PY)
        self.btn_list.append(run_btn)

        # button for settings configuration
        cfg_btn = tk.Button(self, text='Settings', width=BTN_W, command=self.parent.cfg_change)
        cfg_btn.grid(row=0, column=1, padx=PX, pady=PY)
        self.btn_list.append(cfg_btn)

        # button to stop/cancel process
        viw_btn = tk.Button(self, text='Viewer', width=BTN_W, command=self.parent.view)
        viw_btn.grid(row=0, column=2, padx=PX, pady=PY)
        self.btn_list.append(viw_btn)

        # button for application shutdown
        qit_btn = tk.Button(self, text='Quit', width=BTN_W, command=self.parent.exit)
        qit_btn.grid(row=0, column=3, padx=PX, pady=PY)
        self.btn_list.append(qit_btn)
github hahnec / plenopticam / plenopticam / gui / widget_cnfg.py View on Github external
self.tk_vars[key].set(value=value_sel)   # set to default necessary for tkinter's spinbox

            elif PROPERTIES[key][1] == 'bool':
                self.tk_vars[key] = tk.BooleanVar(value=bool(self.cfg.params[key]))
                obj_ent = tk.Checkbutton(self, variable=self.tk_vars[key])

            # place entry
            obj_ent.grid(row=i, column=1, sticky='W')

            # display text from most right
            obj_ent.xview_moveto(1.0) if PROPERTIES[key][1] != 'bool' else None

            self.obj_ents[key] = obj_ent

        self.btn = tk.Button(self, text="Save & Close", width=BTN_W*2, command=self.close)
        self.btn.grid(row=len(self.gui_keys)+1, columnspan=2, padx=PX, pady=PY)

        # makes sure no mouse or keyboard events are sent to other windows (avoid multiple simultaneous instances)
        self.grab_set()
github hahnec / plenopticam / plenopticam / gui / widget_cmnd.py View on Github external
def __init__(self, parent):

        # inheritance
        tk.Frame.__init__(self, parent)
        self.parent = parent
        self.cfg = parent.cfg
        self.btn_list = []

        # button for light field processing
        run_btn = tk.Button(self, text='Process', width=BTN_W, command=self.parent.process)
        run_btn.grid(row=0, column=0, padx=PX, pady=PY)
        self.btn_list.append(run_btn)

        # button for settings configuration
        cfg_btn = tk.Button(self, text='Settings', width=BTN_W, command=self.parent.cfg_change)
        cfg_btn.grid(row=0, column=1, padx=PX, pady=PY)
        self.btn_list.append(cfg_btn)

        # button to stop/cancel process
        viw_btn = tk.Button(self, text='Viewer', width=BTN_W, command=self.parent.view)
        viw_btn.grid(row=0, column=2, padx=PX, pady=PY)
        self.btn_list.append(viw_btn)

        # button for application shutdown
        qit_btn = tk.Button(self, text='Quit', width=BTN_W, command=self.parent.exit)
        qit_btn.grid(row=0, column=3, padx=PX, pady=PY)
        self.btn_list.append(qit_btn)
github hahnec / plenopticam / plenopticam / gui / widget_ctrl.py View on Github external
def instantiate_viewer(self, btn):

        self.view_frame = tk.Toplevel(padx=PX, pady=PY)  # open window
        self.view_frame.resizable(width=0, height=0)     # make window not resizable
        ViewWidget(self.view_frame, cfg=self.cfg, sta=self.sta, btn=btn).pack(expand="no", fill="both")
github hahnec / plenopticam / plenopticam / gui / widget_path.py View on Github external
# store extension names and types
        self.title = title
        self.path_type = path_type
        self.file_exts = file_exts

        # create current path and entry placeholder
        self._path = tk.StringVar(value=path)
        self._path_observers = []
        self.ent = tk.Entry(self, width=2*BTN_W, textvariable=self._path)
        self.ent.grid(row=0, column=0, padx=PX, pady=PY)
        self.ent.xview_moveto(1.0)  # display path from most right

        # create search button
        self.btn = tk.Button(self, width=BTN_W, text=self.title, command=self.choose_path)
        self.btn.grid(row=0, column=1, padx=PX, pady=PY)