def __init__(self, parent, model): super().__init__(parent) self._model = model util.stretchy_rows_cols(self, [0], [0]) self._text = richtext.RichText(self, height=12, scroll="v") self._text.grid(sticky=tk.NSEW, row=0, column=0) self._text.add_text(_text["main"]) frame = ttk.Frame(parent) frame.grid(row=1, column=0, sticky=tk.NSEW) ttk.Label(frame, text=_text["every"]).grid(row=0, column=0, sticky=tk.E, pady=2) self._every_var = tk.StringVar() self._every = ttk.Entry(frame, width=5, textvariable=self._every_var) self._every.grid(row=0, column=1, sticky=tk.W, pady=2) util.IntValidator(self._every, self._every_var, self.change) tooltips.ToolTipYellow(self._every, _text["everytt"]) ttk.Label(frame, text=_text["score"]).grid(row=1, column=0, sticky=tk.E, pady=2) self._score_var = tk.StringVar() self._score = ttk.Entry(frame, width=5, textvariable=self._score_var) self._score.grid(row=1, column=1, sticky=tk.W, pady=2) util.IntValidator(self._score, self._score_var, self.change) tooltips.ToolTipYellow(self._score, _text["scorett"]) self._preview_frame = ttk.LabelFrame(frame, text=_text["pp"]) self._preview_frame.grid(row=2, column=0, columnspan=2, sticky=tk.NSEW, padx=5, pady=5) self._preview_label = ttk.Label(self._preview_frame) self._preview_label.grid(sticky=tk.NSEW) self.update()
def __init__(self, parent, model, parent_model): self._model = model self._parent_model = parent_model super().__init__(parent) subframe = ttk.Frame(self) subframe.grid(row=0, column=0, sticky=tk.W) label = ttk.Label(subframe, text=_text["spbw"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["spbw_tt"]) self._space_bandwidth = tk.StringVar() entry = ttk.Entry(subframe, textvariable=self._space_bandwidth, width=5) entry.grid(row=0, column=1, padx=2) util.IntValidator(entry, self._space_bandwidth, callback=self._space_bw_changed) ttk.Label(subframe, text=_text["spbw1"]).grid(row=0, column=2, padx=2) subframe = ttk.Frame(self) subframe.grid(row=1, column=0, sticky=tk.W) label = ttk.Label(subframe, text=_text["tbw"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["tbw_tt"]) self._time_bandwidth = tk.StringVar() entry = ttk.Entry(subframe, textvariable=self._time_bandwidth, width=5) entry.grid(row=0, column=1, padx=2) util.IntValidator(entry, self._time_bandwidth, callback=self._time_bw_changed) self._plot = mtp.CanvasFigure(self) self._plot.grid(padx=2, pady=2, sticky=tk.NSEW, row=2, column=0) util.stretchy_rows_cols(self, [2], [0]) self._update()
def _add_widgets(self): label = ttk.Label(self, text=_text["size"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["sizett"]) self._size = tk.StringVar() self._size_entry = ttk.Entry(self, textvariable=self._size) self._size_entry.grid(row=0, column=1, padx=2, pady=2) util.IntValidator(self._size_entry, self._size, self._change, False) label = ttk.Label(self, text=_text["xo"]) label.grid(row=1, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["xyott"]) self._xo = tk.StringVar() self._xo_entry = ttk.Entry(self, textvariable=self._xo) self._xo_entry.grid(row=1, column=1, padx=2, pady=2) util.FloatValidator(self._xo_entry, self._xo, self._change, False) label = ttk.Label(self, text=_text["yo"]) label.grid(row=2, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["xyott"]) self._yo = tk.StringVar() self._yo_entry = ttk.Entry(self, textvariable=self._yo) self._yo_entry.grid(row=2, column=1, padx=2, pady=2) util.FloatValidator(self._yo_entry, self._yo, self._change, False) self._plot = None self._plot_grid() self._init()
def __init__(self, parent, model, callback=None): super().__init__(parent) self._model = model self.callback = callback subframe = ttk.Frame(self) subframe.grid(row=2, column=0, padx=2, pady=3, sticky=tk.NW) self._input_crs_label = ttk.Label(subframe, text=_text["icrs"].format("")) self._input_crs_label.grid(row=0, column=0, padx=2) self._input_crs_lavel_tt = tooltips.ToolTipYellow( self._input_crs_label, _text["icrstt"]) label = ttk.Label(subframe, text=_text["newcrs"]) label.grid(row=0, column=1, padx=2) self._output_crs_entry_var = tk.StringVar() self._output_crs_entry = ttk.Entry( subframe, textvariable=self._output_crs_entry_var) self._output_crs_entry.grid(row=0, column=2, padx=2) util.IntValidator(self._output_crs_entry, self._output_crs_entry_var, callback=self._new_epsg, allow_empty=True) tooltips.ToolTipYellow(label, _text["newcrstt"]) href = util.HREF(subframe, text=_text["epsg_url_text"], url=_text["epsg_url"]) href.grid(row=0, column=3, padx=2) tooltips.ToolTipYellow(href, _text["epsg_url"])
def _add_widgets(self): self._selected = tk.StringVar() rb = ttk.Radiobutton(self, text=_text["bi"], value=0, variable=self._selected, command=self._sel_changed) rb.grid(row=0, column=0, sticky=tk.W) tooltips.ToolTipYellow(rb, _text["bi_tt"]) if pyproj is not None: choices = ["utm", "uk", "epsg"] for index, name in enumerate(choices): rb = ttk.Radiobutton(self, text=_text[name], value=index + 1, variable=self._selected, command=self._sel_changed) rb.grid(row=index + 1, column=0, sticky=tk.W) tooltips.ToolTipYellow(rb, _text[name + "_tt"]) self._espg_value = tk.StringVar() self._espg_entry = ttk.Entry(self, textvariable=self._espg_value) self._espg_entry.grid(row=3, column=1, sticky=tk.W) util.IntValidator(widget=self._espg_entry, variable=self._espg_value, callback=self._sel_changed, allow_empty=False) href = util.HREF(self, text=_text["epsg_url_text"], url=_text["epsg_url"]) href.grid(row=3, column=2) tooltips.ToolTipYellow(href, _text["epsg_url"]) else: ttk.Label(self, text=_text["no_pyproj"], wraplength=200).grid(row=1, column=0, sticky=tk.W) self._init()
def _add_controls(self, frame): subframe = tk.Frame(frame) subframe.grid(row=0, column=0, sticky=tk.W) label = ttk.Label(subframe, text=_text["win"]) label.grid(row=0, column=0, padx=5, pady=2) tooltips.ToolTipYellow(label, _text["wintt"]) self._window_var = tk.StringVar() entry = ttk.Entry(subframe, textvariable=self._window_var, width=5) entry.grid(row=0, column=1) util.IntValidator(entry, self._window_var, callback=self._window_changed) ttk.Label(subframe, text=_text["win2"]).grid(row=0, column=2, padx=2) subframe = ttk.LabelFrame(frame, text=_text["kernelframe"]) subframe.grid(row=1, column=0, sticky=tk.NSEW) self._cbox = ttk.Combobox(subframe, height=5, state="readonly") self._cbox["values"] = _text["kernel_choices"] self._cbox.bind("<<ComboboxSelected>>", self._kernel_selected) self._cbox.current(0) self._cbox["width"] = 10 self._cbox.grid(row=0, column=0, sticky=tk.W, padx=2, pady=2) self._kernel_options_frame = ttk.Frame(subframe) self._kernel_options_frame.grid(row=1, column=0, sticky=tk.NSEW) util.stretchy_rows_cols(subframe, [1], [0]) util.stretchy_rows_cols(frame, [1], [0])
def __init__(self, model, parent): super().__init__(parent) self.model = model util.stretchy_rows_cols(self, [2], [0]) text = richtext.RichText(self, height=3, scroll="v") text.grid(row=0, column=0, sticky=tk.NSEW) text.add_text(_text["nkde_main"]) frame = ttk.Frame(self) frame.grid(row=1, column=0, sticky=tk.W) label = ttk.Label(frame, text=_text["nkde_k"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["nkde_k_tt"]) self._k_value = tk.StringVar() entry = ttk.Entry(frame, textvariable=self._k_value) entry.grid(row=0, column=1, padx=2, pady=2) util.IntValidator(entry, self._k_value, callback=self._k_changed) self._plot = mtp.CanvasFigure(self) self._plot.grid(row=2, column=0, sticky=tk.NSEW) tooltips.ToolTipYellow(self._plot, _text["kdeplot"]) self.update()
def _add_controls(self, frame): subframe = ttk.Frame(frame) subframe.grid(row=0, column=0, columnspan=2, sticky=tk.NW) label = ttk.Label(subframe, text=_text["time_bin"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["time_bin_tt"]) self._time_resolution = tk.StringVar() entry = ttk.Entry(subframe, textvariable=self._time_resolution) entry.grid(row=0, column=1, padx=2, pady=2) util.IntValidator(entry, self._time_resolution, callback=self._time_res_changed) self._time_res_cbox = ttk.Combobox(subframe, height=5, state="readonly", width=10) self._time_res_cbox["values"] = _text["time_bin_choices"] self._time_res_cbox.bind("<<ComboboxSelected>>", self._time_res_changed) self._time_res_cbox.current(0) self._time_res_cbox.grid(row=0, column=2, padx=2, pady=2) subframe = ttk.LabelFrame(frame, text=_text["kernel"]) subframe.grid(row=1, column=0, sticky=tk.NSEW, padx=2, pady=2) self._kernel_cbox = ttk.Combobox(subframe, height=5, state="readonly", width=20) self._kernel_cbox["values"] = _text["kernels"] self._kernel_cbox.bind("<<ComboboxSelected>>", self._kernel_changed) self._kernel_cbox.current(0) self._kernel_cbox.grid(row=0, column=0, padx=2, pady=2, sticky=tk.W) self._kernel_frame = ttk.Frame(subframe) self._kernel_frame.grid(row=1, column=0, sticky=tk.NSEW) util.stretchy_rows_cols(subframe, [1], [0]) subframe = ttk.LabelFrame(frame, text=_text["dist"]) subframe.grid(row=1, column=1, sticky=tk.NSEW, padx=2, pady=2) self._dist_cbox = ttk.Combobox(subframe, height=5, state="readonly", width=30) self._dist_cbox["values"] = _text["dists"] self._dist_cbox.bind("<<ComboboxSelected>>", self._dist_changed) self._dist_cbox.current(0) self._dist_cbox.grid(row=0, column=0, padx=2, pady=2, sticky=tk.W) self._dist_frame = ttk.Frame(subframe) self._dist_frame.grid(row=1, column=0, sticky=tk.NSEW) tooltips.ToolTipYellow(self._dist_frame, _text["dist_tt"]) util.stretchy_rows_cols(subframe, [1], [0]) util.stretchy_rows_cols(frame, [1], [0,1])
def _add_widgets(self): subframe = ttk.Frame(self) subframe.grid(row=0, column=0, sticky=tk.W) label = ttk.Label(subframe, text=_text["q_bandwidth"]) label.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(label, _text["q_bandwidth_tt"]) self._quartic_bandwidth_var = tk.StringVar() entry = ttk.Entry(subframe, textvariable=self._quartic_bandwidth_var, width=7) entry.grid(row=0, column=1, padx=2) util.IntValidator(entry, self._quartic_bandwidth_var, callback=self._quartic_bandwidth_changed) ttk.Label(subframe, text=_text["q_bandwidth1"]).grid(row=0, column=2) self._quartic_plot = mtp.CanvasFigure(self) self._quartic_plot.grid(padx=2, pady=2, sticky=tk.NSEW, row=1, column=0) util.stretchy_rows_cols(self, [1], [0])
def add_widgets(self, frame): subframe = ttk.LabelFrame(frame, text=_text["tw"]) subframe.grid(row=0, column=0, padx=2, pady=2, sticky=tk.NSEW) self._time_window_option = tk.IntVar() rb = ttk.Radiobutton(subframe, text=_text["tw1"], variable=self._time_window_option, value=STScan.TimeWindowChoice.from_training.value, command=self._time_window_option_changed) rb.grid(row=0, column=0, padx=2, pady=2, sticky=tk.W) tooltips.ToolTipYellow(rb, _text["tw1tt"]) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=1, column=0, sticky=tk.W) rb = ttk.Radiobutton(subsubframe, text=_text["tw2"], variable=self._time_window_option, value=STScan.TimeWindowChoice.window.value, command=self._time_window_option_changed) rb.grid(row=0, column=0, padx=2, pady=2) tooltips.ToolTipYellow(rb, _text["tw2tt"]) self._time_window_length_var = tk.StringVar() self._time_window_length = ttk.Entry( subsubframe, textvariable=self._time_window_length_var, width=7) self._time_window_length.grid(row=0, column=1, padx=2) util.IntValidator(self._time_window_length, self._time_window_length_var, callback=self._time_window_changed) ttk.Label(subsubframe, text=_text["tw3"]).grid(row=0, column=2, padx=2) subframe = ttk.LabelFrame(frame, text=_text["qu"]) subframe.grid(row=0, column=1, padx=2, pady=2, sticky=tk.NSEW) self._quantise_option = tk.IntVar() for n in range(1, 5): label = _text["qu{}".format(n)] rb = ttk.Radiobutton(subframe, text=label, variable=self._quantise_option, value=n, command=self._quantise_option_changed) rb.grid(row=n, column=0, padx=2, pady=2, sticky=tk.W) tooltips.ToolTipYellow(rb, _text["qu{}tt".format(n)]) subframe = ttk.LabelFrame(subframe, text=_text["quu"]) tooltips.ToolTipYellow(subframe, _text["quutt"]) subframe.grid(row=0, column=1, rowspan=4, padx=2, sticky=tk.NSEW) ttk.Label(subframe, text=_text["qu5"]).grid(row=0, column=0, padx=2, pady=2, sticky=tk.W) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=1, column=0) self._time_bin_length_var = tk.StringVar() self._time_bin_length = ttk.Entry( subsubframe, textvariable=self._time_bin_length_var, width=7) util.IntValidator(self._time_bin_length, self._time_bin_length_var, callback=self._time_bin_changed) self._time_bin_length.grid(row=0, column=0, padx=2, pady=2) ttk.Label(subsubframe, text=_text["qu6"]).grid(row=0, column=1, padx=2, pady=2) subframe = ttk.LabelFrame(frame, text=_text["opt1"]) subframe.grid(row=1, column=0, padx=2, pady=2, sticky=tk.NSEW) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=0, column=0, sticky=tk.W) self._geo_pop_limit_var = tk.StringVar() entry = self._add_entry_row(subsubframe, text=_text["opt2"], tttext=_text["opt2tt"], entry_var=self._geo_pop_limit_var, last_text=_text["optper"]) util.PercentageValidator(entry, self._geo_pop_limit_var, callback=self._option_changed) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=1, column=0, sticky=tk.W) self._geo_radius_limit_var = tk.StringVar() entry = self._add_entry_row(subsubframe, text=_text["opt3"], tttext=_text["opt3tt"], entry_var=self._geo_radius_limit_var, last_text=_text["optm"]) util.IntValidator(entry, self._geo_radius_limit_var, callback=self._option_changed) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=2, column=0, sticky=tk.W) self._time_pop_limit_var = tk.StringVar() entry = self._add_entry_row(subsubframe, text=_text["opt4"], tttext=_text["opt4tt"], entry_var=self._time_pop_limit_var, last_text=_text["optper"]) util.PercentageValidator(entry, self._time_pop_limit_var, callback=self._option_changed) subsubframe = ttk.Frame(subframe) subsubframe.grid(row=3, column=0, sticky=tk.W) self._time_radius_limit_var = tk.StringVar() entry = self._add_entry_row(subsubframe, text=_text["opt5"], tttext=_text["opt5tt"], entry_var=self._time_radius_limit_var, last_text=_text["optdays"]) util.IntValidator(entry, self._time_radius_limit_var, callback=self._option_changed) subframe = ttk.LabelFrame(frame, text=_text["clop"]) subframe.grid(row=1, column=1, padx=2, pady=2, sticky=tk.NSEW) self._cluster_option = tk.IntVar() for i, (t1, t2, val) in enumerate( zip([_text["clop1"], _text["clop2"]], [_text["clop1tt"], _text["clop2tt"]], [ STScan.ClusterOption.none.value, STScan.ClusterOption.expand.value ])): rb = ttk.Radiobutton(subframe, text=t1, variable=self._cluster_option, value=val, command=self._cluster_option_changed) rb.grid(row=i, column=0, padx=2, pady=2, sticky=tk.W) tooltips.ToolTipYellow(rb, t2)