Beispiel #1
0
    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()
Beispiel #2
0
 def __init__(self, model, parent):
     super().__init__(parent)
     self.model = model
     util.stretchy_columns(self, [0])
     text = richtext.RichText(self, height=3, scroll="v")
     text.grid(row=0, column=0, sticky=tk.NSEW)
     text.add_text(_text["to_main"])
Beispiel #3
0
 def __init__(self, parent, model):
     self._model = model
     super().__init__(parent)
     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 = tk.Frame(self)
     frame.grid(sticky=tk.NSEW, row=1, column=0)
     self.add_widgets(frame)
     self.update()
Beispiel #4
0
 def __init__(self, parent, model):
     super().__init__(parent)
     self._model = model
     util.stretchy_rows_cols(self, [0], [0])
     self._text = richtext.RichText(self, height=14, scroll="v")
     self._text.grid(sticky=tk.NSEW)
     self._text.add_text(_text["main"])
     frame = ttk.LabelFrame(self, text=_text["settings"])
     frame.grid(row=1, column=0, sticky=tk.NSEW)
     self._add_widgets(frame)
     self._update()
 def __init__(self, parent, model):
     self._model = model
     super().__init__(parent)
     util.stretchy_rows_cols(self, [1], [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 = tk.Frame(self)
     frame.grid(sticky=tk.NSEW, row=1, column=0)
     self._add_controls(frame)
     self._update()
Beispiel #6
0
 def __init__(self, parent, model):
     super().__init__(parent)
     self.model = model
     util.stretchy_rows_cols(self, [1], [0])
     self._text = richtext.RichText(self, height=12, scroll="v")
     self._text.grid(row=0, column=0, sticky=tk.NSEW)
     self._text.add_text(_text["main"])
     frame = ttk.Frame(self)
     self.add_widgets(frame)
     frame.grid(row=1, column=0, sticky=tk.NSEW)
     self.update()
Beispiel #7
0
    def __init__(self, parent, model, style):
        super().__init__(parent)
        self._model = model
        util.stretchy_rows_cols(self, [3], [0])
        if style == "normal":
            self._text = richtext.RichText(self, height=12, scroll="v")
            self._text.grid(sticky=tk.NSEW, row=0, column=0)
            if gpd is None:
                self._error_case()
                return
            self._text.add_text(_text["main"])

        subframe = ttk.Frame(self)
        subframe.grid(row=1, column=0, padx=2, pady=3, sticky=tk.NW)
        ttk.Button(subframe, text=_text["load"],
                   command=self._load).grid(row=0, column=0, padx=2)
        self._filename_label = ttk.Label(subframe)
        self._filename_label.grid(row=0, column=1, padx=2)
        tooltips.ToolTipYellow(self._filename_label, _text["filett"])

        self._projectors_widget = projectors_view.GeoFrameProjectorWidget(
            self, self._model._projector, self._update)
        self._projectors_widget.grid(row=2,
                                     column=0,
                                     padx=2,
                                     pady=3,
                                     sticky=tk.NW)

        subframe = ttk.Frame(self)
        subframe.grid(row=3, column=0, padx=2, pady=3, sticky=tk.NSEW)
        util.stretchy_rows_cols(subframe, [0], [0, 1])
        self._preview_frame = ttk.LabelFrame(subframe, text=_text["preview"])
        self._preview_frame.grid(row=0, column=0, sticky=tk.NSEW, padx=2)
        util.stretchy_rows_cols(self._preview_frame, [0], [0])
        self._preview_canvas = mtp.CanvasFigure(self._preview_frame)
        self._preview_canvas.grid(sticky=tk.NSEW, padx=1, pady=1)
        self._preview_frame_tt = tooltips.ToolTipYellow(
            self._preview_frame, _text["previewnonett"])

        with_coords_frame = ttk.LabelFrame(subframe, text=_text["preview2"])
        with_coords_frame.grid(row=0, column=1, sticky=tk.NSEW, padx=2)
        util.stretchy_rows_cols(with_coords_frame, [0], [0])
        self._with_coords_canvas = mtp.CanvasFigure(with_coords_frame)
        self._with_coords_canvas.grid(sticky=tk.NSEW, padx=1, pady=1)
        self._with_coords_frame_tt = tooltips.ToolTipYellow(
            with_coords_frame, _text["previewnonett"])

        self._update()
Beispiel #8
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["scipy_main"])

            self._plot = mtp.CanvasFigure(self)
            self._plot.grid(row=2, column=0, sticky=tk.NSEW)
            tooltips.ToolTipYellow(self._plot, _text["kdeplot"])
            coords = self.model.main_model.test_coords()
            if coords is None:
                return
            kernel_provider = self.model.make_kernel()
            task = self.make_plot_task(kernel_provider, coords)
            self._plot.set_figure_task(task)
Beispiel #9
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()
Beispiel #10
0
    def add_widgets(self):
        self._text = richtext.RichText(self, height=12, scroll="v")
        util.stretchy_rows_cols(self, [0], [0])
        self._text.grid(sticky=tk.NSEW)
        self._queue = queue.Queue()
        predictors.set_queue_logging(self._queue)

        self._bottom_frame = ttk.Frame(self)
        self._bottom_frame.grid(row=1, column=0, sticky=tk.EW)
        util.stretchy_columns(self._bottom_frame, [2])
        self._okay_button = ttk.Button(self._bottom_frame,
                                       text=_text["okay"],
                                       command=self.cancel)
        self._okay_button.grid(row=0, column=0, padx=5, pady=3, ipadx=20)
        self._okay_button.state(["disabled"])
        self._cancel_button = ttk.Button(self._bottom_frame,
                                         text=_text["cancel"],
                                         command=self._cancel)
        self._cancel_button.grid(row=0, column=1, padx=5, pady=3, ipadx=20)
        self._done = False
        self._poll_task()
Beispiel #11
0
    def __init__(self, parent, model):
        super().__init__(parent)
        self._model = model
        #util.stretchy_rows_cols(self, [3], [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"])

        subframe = ttk.LabelFrame(self, text=_text["coverage"])
        subframe.grid(row=1, column=0, sticky=tk.W)
        self._coverage_choice = tk.IntVar()
        self._add_rb(subframe, "top1", 1).grid(row=0,
                                               column=0,
                                               padx=2,
                                               sticky=tk.W)
        self._add_rb(subframe, "top5", 2).grid(row=1,
                                               column=0,
                                               padx=2,
                                               sticky=tk.W)
        self._add_rb(subframe, "top10", 3).grid(row=2,
                                                column=0,
                                                padx=2,
                                                sticky=tk.W)
        frame = ttk.Frame(subframe)
        self._add_rb(frame, "topcus", 4).grid(row=0,
                                              column=0,
                                              padx=2,
                                              sticky=tk.W)
        self._risk_level = tk.StringVar()
        self._risk_level.set(20)
        self._risk_level_entry = ttk.Entry(frame,
                                           textvariable=self._risk_level)
        self._risk_level_entry.grid(row=0, column=1, padx=2, sticky=tk.W)
        self._risk_level_entry["state"] = tk.DISABLED
        frame.grid(row=3, column=0, sticky=tk.W)
        util.PercentageValidator(self._risk_level_entry,
                                 self._risk_level,
                                 callback=self._coverage_choice_change)

        self._update()
Beispiel #12
0
 def _add_info_box(self, frame):
     self._text = richtext.RichText(frame, height=10, scroll="v")
     self._text.grid(row=0, column=0, padx=1, pady=1, sticky=tk.NSEW)
     self._text.add_text(_text["plat"].format(sys.platform))
     self._text.add_text(_text["tcl"].format(
         tk.Tcl().eval('info patchlevel')))
     self._text.add_text(_text["pyplat"].format(sys.implementation))
     self._text.add_text(_text["pyroot"].format(sys.base_prefix))
     self._text.add_text(_text["np"].format(np.__version__))
     self._text.add_text(_text["scipy"].format(scipy.__version__))
     if gpd is not None:
         self._text.add_text(_text["gpd"].format(gpd.__version__))
     else:
         self._text.add_text(_text["gpd_none"])
     if pyproj is not None:
         self._text.add_text(_text["pyproj"].format(pyproj.__version__))
     else:
         self._text.add_text(_text["pyproj_none"])
     if tilemapbase is not None:
         self._text.add_text(_text["tilemapbase"].format(
             tilemapbase.__version__))
     else:
         self._text.add_text(_text["tilemapbase_none"])
Beispiel #13
0
 def __init__(self, parent):
     super().__init__(parent)
     util.stretchy_rows_cols(self, [0], [0])
     self._text = richtext.RichText(self, height=14, scroll="v")
     self._text.grid(sticky=tk.NSEW)
     self._text.add_text(_text["main"])
Beispiel #14
0
print("Should run from the base directory")
import sys, os.path
sys.path.insert(0, os.path.abspath("."))

import open_cp.gui.tk.richtext as richtext
import open_cp.gui.tk.util as util

import tkinter as tk

root = tk.Tk()
util.stretchy_rows_cols(root, [0], [0])

rt = richtext.RichText(root, height=10)#, scroll="v")
rt.add_text("Hello, world!")
rt.add_text("  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris erat ipsum, faucibus eu mauris sit amet, pulvinar consequat turpis. Cras commodo enim lectus, quis egestas massa consequat nec. Cras fringilla commodo congue. Proin fringilla eros ac felis hendrerit, ac mollis ante consequat. Fusce commodo fermentum dapibus. Vivamus at dolor pulvinar, dignissim mauris a, tempus augue. Donec laoreet ut metus id lobortis. Maecenas eu metus in nunc efficitur dapibus nec congue leo. Nunc eget odio nisi. Curabitur scelerisque, elit a ultrices tempor, neque lectus pharetra sem, eget malesuada nisi est a massa. Aliquam hendrerit rhoncus viverra. Morbi aliquet eros leo, quis cursus orci dapibus mollis. Fusce varius lorem congue sem porta euismod. Sed quis tellus eu felis hendrerit tempor. Fusce tincidunt sapien vel massa ultrices, ornare facilisis arcu laoreet.")
rt.grid(sticky=tk.NSEW, padx=20, pady=20)

rt.set_height_to_view()


root.mainloop()