Example #1
0
class Data_Cell(Cell):
    def __init__(self,
                 master,
                 variable,
                 anchor=W,
                 bordercolor=None,
                 borderwidth=1,
                 padx=0,
                 pady=0,
                 background=None,
                 foreground=None,
                 font=None):
        Cell.__init__(self,
                      master,
                      background=background,
                      highlightbackground=bordercolor,
                      highlightcolor=bordercolor,
                      highlightthickness=borderwidth,
                      bd=0)

        self._message_widget = Message(self,
                                       textvariable=variable,
                                       font=font,
                                       background=background,
                                       foreground=foreground)
        self._message_widget.pack(expand=True,
                                  padx=padx,
                                  pady=pady,
                                  anchor=anchor)

        self.bind("<Configure>", self._on_configure)

    def _on_configure(self, event):
        self._message_widget.configure(width=event.width)
Example #2
0
class Data_Cell(Cell):
    def __init__(self, master, variable, anchor=W, bordercolor=None, borderwidth=1, padx=0, pady=0, background=None, foreground=None, font=None):
        Cell.__init__(self, master, background=background, highlightbackground=bordercolor, highlightcolor=bordercolor, highlightthickness=borderwidth, bd= 0)

        self._message_widget = Message(self, textvariable=variable, font=font, background=background, foreground=foreground)
        self._message_widget.pack(expand=True, padx=padx, pady=pady, anchor=anchor)

        self.bind("<Configure>", self._on_configure)

    def _on_configure(self, event):
        self._message_widget.configure(width=event.width)
class Data_Cell(Cell):
    """
     A Class used as a data cell for a table widget

    Methods
    -------
    _on_configure()
            Description | Message widget configuration

    """
    def __init__(self,
                 master,
                 variable,
                 anchor=CENTER,
                 bordercolor=None,
                 borderwidth=1,
                 padx=0,
                 pady=0,
                 background=None,
                 foreground=None,
                 font=None):
        """
        Parameters
        ----------

        :param master: the master of the data cell
        :param variable: data variable
        :param anchor: anchor
        :param bordercolor: the color of the border
        :param borderwidth: the width of the data cell border
        :param padx: x coordinate padding
        :param pady: y coordinate padding
        :param background: background color
        :param foreground: foreground color
        :param font: text font
        """
        Cell.__init__(self,
                      master,
                      background=background,
                      highlightbackground=bordercolor,
                      highlightcolor=bordercolor,
                      highlightthickness=borderwidth,
                      bd=0)

        self._message_widget = Message(self,
                                       textvariable=variable,
                                       font=font,
                                       background=background,
                                       foreground=foreground)

        self._message_widget.pack(padx=padx, pady=pady, anchor=anchor)

        self._message_widget.configure(width=110, pady=1.2)
Example #4
0
class Tool_Path_Generator:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
        _bgcolor = '#e6e6e6'  # X11 color: 'gray85'
        _fgcolor = '#000000'  # X11 color: 'black'
        font11 = "-size 15 -weight normal -slant roman "  \
            "-underline 0 -overstrike 0"

        self.axial_length = DoubleVar()
        self.printbed_diameter = DoubleVar()
        self.final_diameter = DoubleVar()
        self.filament_width_og = DoubleVar()
        self.helix_angle = DoubleVar()
        self.smear_factor = DoubleVar()
        self.flow_rate = DoubleVar()
        self.uv_offset = DoubleVar()
        self.use_strong_pattern = BooleanVar()

        self.axial_length.set(200.0)
        self.printbed_diameter.set(10.0)
        self.final_diameter.set(15.0)
        self.filament_width_og.set(0.41)
        self.helix_angle.set(45.0)
        self.smear_factor.set(100.0)
        self.flow_rate.set(0.0015)
        self.uv_offset.set(32.5)
        self.use_strong_pattern.set(True)

        top.geometry("700x550")
        top.title("SkelePrint Tool Path Generator")
        top.configure(background="#e6e6e6")
        top.configure(highlightbackground="#e6e6e6")
        top.configure(highlightcolor="black")

        self.Label7 = Label(top)
        self.Label7.grid(row=0, column=0, sticky=W)
        self.Label7.configure(background="#e6e6e6")
        self.Label7.configure(font=font11)
        self.Label7.configure(foreground="#000000")
        self.Label7.configure(text='''SkelePrint Tool Path Generator''')

        self.Labelframe1 = LabelFrame(top)
        self.Labelframe1.grid(row=1, column=0, sticky=N+S)
        self.Labelframe1.configure(relief=GROOVE)
        self.Labelframe1.configure(foreground="black")
        self.Labelframe1.configure(text='''Dimensions''')
        self.Labelframe1.configure(background="#e6e6e6")
        self.Labelframe1.configure(highlightbackground="#e6e6e6")
        self.Labelframe1.configure(highlightcolor="black")

        self.axial_length_entry = Entry(self.Labelframe1)
        self.axial_length_entry.grid(row=0, column=1)
        self.axial_length_entry.configure(background="white")
        self.axial_length_entry.configure(font="TkFixedFont")
        self.axial_length_entry.configure(foreground="#000000")
        self.axial_length_entry.configure(highlightbackground="#e6e6e6")
        self.axial_length_entry.configure(highlightcolor="black")
        self.axial_length_entry.configure(insertbackground="black")
        self.axial_length_entry.configure(selectbackground="#c4c4c4")
        self.axial_length_entry.configure(selectforeground="black")
        self.axial_length_entry.configure(textvariable=self.axial_length)

        self.Label1 = Label(self.Labelframe1)
        self.Label1.grid(row=0, column=0, sticky=E)
        self.Label1.configure(activebackground="#e6e6e6")
        self.Label1.configure(activeforeground="black")
        self.Label1.configure(background="#e6e6e6")
        self.Label1.configure(foreground="#000000")
        self.Label1.configure(highlightbackground="#e6e6e6")
        self.Label1.configure(highlightcolor="black")
        self.Label1.configure(text='''Axial Length''')

        self.Label2 = Label(self.Labelframe1)
        self.Label2.grid(row=0, column=2, sticky=W)
        self.Label2.configure(activebackground="#e6e6e6")
        self.Label2.configure(activeforeground="black")
        self.Label2.configure(background="#e6e6e6")
        self.Label2.configure(disabledforeground="#e6e6e6")
        self.Label2.configure(foreground="#000000")
        self.Label2.configure(highlightbackground="#e6e6e6")
        self.Label2.configure(highlightcolor="black")
        self.Label2.configure(text='''mm''')

        self.Label3 = Label(self.Labelframe1)
        self.Label3.grid(row=1, column=0, sticky=E)
        self.Label3.configure(activebackground="#e6e6e6")
        self.Label3.configure(activeforeground="black")
        self.Label3.configure(background="#e6e6e6")
        self.Label3.configure(foreground="#000000")
        self.Label3.configure(highlightbackground="#e6e6e6")
        self.Label3.configure(highlightcolor="black")
        self.Label3.configure(text='''Printbed Diameter''')

        self.Entry2 = Entry(self.Labelframe1)
        self.Entry2.grid(row=1, column=1)
        self.Entry2.configure(background="white")
        self.Entry2.configure(font="TkFixedFont")
        self.Entry2.configure(foreground="#000000")
        self.Entry2.configure(highlightbackground="#e6e6e6")
        self.Entry2.configure(highlightcolor="black")
        self.Entry2.configure(insertbackground="black")
        self.Entry2.configure(selectbackground="#c4c4c4")
        self.Entry2.configure(selectforeground="black")
        self.Entry2.configure(textvariable=self.printbed_diameter)

        self.Label4 = Label(self.Labelframe1)
        self.Label4.grid(row=1, column=2, sticky=W)
        self.Label4.configure(activebackground="#e6e6e6")
        self.Label4.configure(activeforeground="black")
        self.Label4.configure(background="#e6e6e6")
        self.Label4.configure(foreground="#000000")
        self.Label4.configure(highlightbackground="#e6e6e6")
        self.Label4.configure(highlightcolor="black")
        self.Label4.configure(text='''mm''')

        self.Label5 = Label(self.Labelframe1)
        self.Label5.grid(row=2, column=0, sticky=E)
        self.Label5.configure(activebackground="#e6e6e6")
        self.Label5.configure(activeforeground="black")
        self.Label5.configure(background="#e6e6e6")
        self.Label5.configure(foreground="#000000")
        self.Label5.configure(highlightbackground="#e6e6e6")
        self.Label5.configure(highlightcolor="black")
        self.Label5.configure(text='''Final Print Diameter''')

        self.final_diameter_entry = Entry(self.Labelframe1)
        self.final_diameter_entry.grid(row=2, column=1)
        self.final_diameter_entry.configure(background="white")
        self.final_diameter_entry.configure(font="TkFixedFont")
        self.final_diameter_entry.configure(foreground="#000000")
        self.final_diameter_entry.configure(highlightbackground="#e6e6e6")
        self.final_diameter_entry.configure(highlightcolor="black")
        self.final_diameter_entry.configure(insertbackground="black")
        self.final_diameter_entry.configure(selectbackground="#c4c4c4")
        self.final_diameter_entry.configure(selectforeground="black")
        self.final_diameter_entry.configure(textvariable=self.final_diameter)

        self.Label6 = Label(self.Labelframe1)
        self.Label6.grid(row=2, column=2, sticky=W)
        self.Label6.configure(activebackground="#e6e6e6")
        self.Label6.configure(activeforeground="black")
        self.Label6.configure(background="#e6e6e6")
        self.Label6.configure(foreground="#000000")
        self.Label6.configure(highlightbackground="#e6e6e6")
        self.Label6.configure(highlightcolor="black")
        self.Label6.configure(text='''mm''')

        self.Entry4 = Entry(self.Labelframe1)
        self.Entry4.grid(row=3, column=1)
        self.Entry4.configure(background="white")
        self.Entry4.configure(font="TkFixedFont")
        self.Entry4.configure(foreground="#000000")
        self.Entry4.configure(highlightbackground="#e6e6e6")
        self.Entry4.configure(highlightcolor="black")
        self.Entry4.configure(insertbackground="black")
        self.Entry4.configure(selectbackground="#c4c4c4")
        self.Entry4.configure(selectforeground="black")
        self.Entry4.configure(textvariable=self.filament_width_og)

        self.Label7 = Label(self.Labelframe1)
        self.Label7.grid(row=3, column=2, sticky=W)
        self.Label7.configure(activebackground="#e6e6e6")
        self.Label7.configure(activeforeground="black")
        self.Label7.configure(background="#e6e6e6")
        self.Label7.configure(foreground="#000000")
        self.Label7.configure(highlightbackground="#e6e6e6")
        self.Label7.configure(highlightcolor="black")
        self.Label7.configure(text='''mm''')

        self.Label8 = Label(self.Labelframe1)
        self.Label8.grid(row=3, column=0, sticky=E)
        self.Label8.configure(activebackground="#e6e6e6")
        self.Label8.configure(activeforeground="black")
        self.Label8.configure(background="#e6e6e6")
        self.Label8.configure(foreground="#000000")
        self.Label8.configure(highlightbackground="#e6e6e6")
        self.Label8.configure(highlightcolor="black")
        self.Label8.configure(text='''Filament Width''')

        self.tip = Label(self.Labelframe1, width=300, height=300)

        __location__ = os.path.realpath(
            os.path.join(os.getcwd(), os.path.dirname(__file__)))

        img = Image.open(os.path.join(__location__, 'dimensions.png'))
        one = ImageTk.PhotoImage(img)

        self.tip = Label(self.Labelframe1, image=one)
        self.tip.image = one
        self.tip.configure(background="#e6e6e6")
        self.tip.grid(row=4, columnspan=3)

        self.Labelframe2 = LabelFrame(top)
        self.Labelframe2.grid(row=1, column=1, sticky=N+S)
        self.Labelframe2.configure(relief=GROOVE)
        self.Labelframe2.configure(foreground="black")
        self.Labelframe2.configure(text='''Print Properties''')
        self.Labelframe2.configure(background="#e6e6e6")
        self.Labelframe2.configure(highlightbackground="#e6e6e6")
        self.Labelframe2.configure(highlightcolor="black")

        self.Label9 = Label(self.Labelframe2)
        self.Label9.grid(row=0, column=0, sticky=E)
        self.Label9.configure(activebackground="#e6e6e6")
        self.Label9.configure(activeforeground="black")
        self.Label9.configure(background="#e6e6e6")
        self.Label9.configure(foreground="#000000")
        self.Label9.configure(highlightbackground="#e6e6e6")
        self.Label9.configure(highlightcolor="black")
        self.Label9.configure(text='''Helix Angle''')

        self.Entry5 = Entry(self.Labelframe2)
        self.Entry5.grid(row=0, column=1)
        self.Entry5.configure(background="white")
        self.Entry5.configure(font="TkFixedFont")
        self.Entry5.configure(foreground="#000000")
        self.Entry5.configure(highlightbackground="#e6e6e6")
        self.Entry5.configure(highlightcolor="black")
        self.Entry5.configure(insertbackground="black")
        self.Entry5.configure(selectbackground="#c4c4c4")
        self.Entry5.configure(selectforeground="black")
        self.Entry5.configure(textvariable=self.helix_angle)

        self.Label10 = Label(self.Labelframe2)
        self.Label10.grid(row=0, column=2, sticky=W)
        self.Label10.configure(activebackground="#e6e6e6")
        self.Label10.configure(activeforeground="black")
        self.Label10.configure(background="#e6e6e6")
        self.Label10.configure(foreground="#000000")
        self.Label10.configure(highlightbackground="#e6e6e6")
        self.Label10.configure(highlightcolor="black")
        self.Label10.configure(text='''degrees [0 - 90]''')

        self.strong_targeter_button = Radiobutton(self.Labelframe2)
        self.strong_targeter_button.grid(row=1, column=0, sticky=E)
        self.strong_targeter_button.configure(variable=self.use_strong_pattern)
        self.strong_targeter_button.configure(value=True)
        self.strong_targeter_button.configure(activebackground="#e6e6e6")
        self.strong_targeter_button.configure(activeforeground="black")
        self.strong_targeter_button.configure(background="#e6e6e6")
        self.strong_targeter_button.configure(foreground="#000000")
        self.strong_targeter_button.configure(highlightbackground="#e6e6e6")
        self.strong_targeter_button.configure(highlightcolor="black")

        self.strong_targeter_label = Label(self.Labelframe2)
        self.strong_targeter_label.grid(row=1, column=1, sticky=W)
        self.strong_targeter_label.configure(activebackground="#e6e6e6")
        self.strong_targeter_label.configure(activeforeground="black")
        self.strong_targeter_label.configure(background="#e6e6e6")
        self.strong_targeter_label.configure(foreground="#000000")
        self.strong_targeter_label.configure(highlightbackground="#e6e6e6")
        self.strong_targeter_label.configure(highlightcolor="black")
        self.strong_targeter_label.configure(text="Strong angle pattern")

        self.default_targeter_button = Radiobutton(self.Labelframe2)
        self.default_targeter_button.grid(row=2, column=0, sticky=E)
        self.default_targeter_button.configure(activebackground="#e6e6e6")
        self.default_targeter_button.configure(activeforeground="black")
        self.default_targeter_button.configure(background="#e6e6e6")
        self.default_targeter_button.configure(foreground="#000000")
        self.default_targeter_button.configure(highlightbackground="#e6e6e6")
        self.default_targeter_button.configure(highlightcolor="black")
        self.default_targeter_button.configure(
                variable=self.use_strong_pattern)
        self.default_targeter_button.configure(value=False)

        self.default_targeter_label = Label(self.Labelframe2)
        self.default_targeter_label.grid(row=2, column=1, sticky=W)
        self.default_targeter_label.configure(activebackground="#e6e6e6")
        self.default_targeter_label.configure(activeforeground="black")
        self.default_targeter_label.configure(background="#e6e6e6")
        self.default_targeter_label.configure(foreground="#000000")
        self.default_targeter_label.configure(highlightbackground="#e6e6e6")
        self.default_targeter_label.configure(highlightcolor="black")
        self.default_targeter_label.configure(text="Default angle pattern")

        self.Scale1 = Scale(self.Labelframe2)
        self.Scale1.grid(row=5, column=1, columnspan=2, sticky=S+W)
        self.Scale1.configure(activebackground="#e6e6e6")
        self.Scale1.configure(background="#e6e6e6")
        self.Scale1.configure(font="TkTextFont")
        self.Scale1.configure(foreground="#000000")
        self.Scale1.configure(from_="5.0")
        self.Scale1.configure(highlightbackground="#d9d9d9")
        self.Scale1.configure(highlightcolor="black")
        self.Scale1.configure(length="150")
        self.Scale1.configure(orient="horizontal")
        self.Scale1.configure(resolution="5.0")
        self.Scale1.configure(troughcolor="#d9d9d9")
        self.Scale1.configure(variable=self.smear_factor)

        self.Label8 = Label(self.Labelframe2)
        self.Label8.grid(row=3, column=0, sticky=E)
        self.Label8.configure(background="#e6e6e6")
        self.Label8.configure(foreground="#000000")
        self.Label8.configure(text='''Flow rate''')

        self.Entry6 = Entry(self.Labelframe2)
        self.Entry6.grid(row=3, column=1)
        self.Entry6.configure(background="white")
        self.Entry6.configure(font="TkFixedFont")
        self.Entry6.configure(foreground="#000000")
        self.Entry6.configure(highlightbackground="#e6e6e6")
        self.Entry6.configure(highlightcolor="black")
        self.Entry6.configure(insertbackground="black")
        self.Entry6.configure(selectbackground="#c4c4c4")
        self.Entry6.configure(selectforeground="black")
        self.Entry6.configure(textvariable=self.flow_rate)

        self.Label12 = Label(self.Labelframe2)
        self.Label12.grid(row=3, column=2, sticky=W)
        self.Label12.configure(activebackground="#e6e6e6")
        self.Label12.configure(activeforeground="black")
        self.Label12.configure(background="#e6e6e6")
        self.Label12.configure(foreground="#000000")
        self.Label12.configure(highlightbackground="#d9d9d9")
        self.Label12.configure(highlightcolor="black")
        self.Label12.configure(text='''cm^3 / s''')

        self.uv_label = Label(self.Labelframe2)
        self.uv_label.grid(row=4, column=0, sticky=E)
        self.uv_label.configure(activebackground="#e6e6e6")
        self.uv_label.configure(activeforeground="black")
        self.uv_label.configure(background="#e6e6e6")
        self.uv_label.configure(foreground="#000000")
        self.uv_label.configure(highlightbackground="#d9d9d9")
        self.uv_label.configure(highlightcolor="black")
        self.uv_label.configure(text="UV Distance")

        self.uv_entry = Entry(self.Labelframe2)
        self.uv_entry.grid(row=4, column=1)
        self.uv_entry.configure(background="white")
        self.uv_entry.configure(font="TkFixedFont")
        self.uv_entry.configure(foreground="#000000")
        self.uv_entry.configure(highlightbackground="#e6e6e6")
        self.uv_entry.configure(highlightcolor="black")
        self.uv_entry.configure(insertbackground="black")
        self.uv_entry.configure(selectbackground="#c4c4c4")
        self.uv_entry.configure(selectforeground="black")
        self.uv_entry.configure(textvariable=self.uv_offset)

        self.uv_label_2 = Label(self.Labelframe2)
        self.uv_label_2.grid(row=4, column=2, sticky=W)
        self.uv_label_2.configure(activebackground="#e6e6e6")
        self.uv_label_2.configure(activeforeground="black")
        self.uv_label_2.configure(background="#e6e6e6")
        self.uv_label_2.configure(foreground="#000000")
        self.uv_label_2.configure(highlightbackground="#d9d9d9")
        self.uv_label_2.configure(highlightcolor="black")
        self.uv_label_2.configure(text='''mm''')

        self.Label11 = Label(self.Labelframe2)
        self.Label11.grid(row=5, column=0, sticky=S+E)
        self.Label11.configure(activebackground="#e6e6e6")
        self.Label11.configure(activeforeground="black")
        self.Label11.configure(background="#e6e6e6")
        self.Label11.configure(foreground="#000000")
        self.Label11.configure(highlightbackground="#d9d9d9")
        self.Label11.configure(highlightcolor="black")
        self.Label11.configure(text='''Layer Height %''')

        self.Label13 = Label(self.Labelframe2)
        self.Label13.grid(row=6, columnspan=3)
        self.Label13.configure(activebackground="#f9f9f9")
        self.Label13.configure(activeforeground="black")
        self.Label13.configure(background="#e6e6e6")
        self.Label13.configure(foreground="#000000")
        self.Label13.configure(highlightbackground="#d9d9d9")
        self.Label13.configure(highlightcolor="black")
        self.Label13.configure(text='''caution: layer height % is experimental
default = 100% (ie. layer height = filament width)''')

        self.Message1 = Message(self.Labelframe2)
        self.Message1.grid(row=8, columnspan=3)
        self.Message1.configure(anchor=N)
        self.Message1.configure(background="#e6e6e6")
        self.Message1.configure(foreground="#000000")
        self.Message1.configure(highlightbackground="#e6e6e6")
        self.Message1.configure(highlightcolor="black")
        self.Message1.configure(text='''Helix Angle Conditions:
If the angle is > 90, it will be set to 90 degrees

If angle is < 0, it will be set to 0 degrees

If angle = 0, the layer will consist of a single helix printed as close \
together as possible

If angle = 90, the layer will consist of many straight lines''')

        self.tip2 = Label(self.Labelframe2, width=300, height=91)

        img2 = Image.open(os.path.join(__location__, 'theta.jpg'))
        two = ImageTk.PhotoImage(img2)

        self.tip2 = Label(self.Labelframe2, image=two)
        self.tip2.image = two
        self.tip2.configure(background="#e6e6e6")
        self.tip2.grid(row=7, columnspan=3)

        self.Label8 = Label(top)
        self.Label8.grid(row=5, columnspan=2)
        self.Label8.configure(background="#e6e6e6")
        self.Label8.configure(foreground="#000000")
        self.Label8.configure(text='''G Code file will be saved on your Desktop under:
"gcode/timestamp_skeleprint_gcode.gcode"''')

        self.Button1 = Button(top)
        self.Button1.grid(row=2, columnspan=2)
        self.Button1.configure(activebackground="#e6e6e6")
        self.Button1.configure(activeforeground="#e6e6e6")
        self.Button1.configure(background="#e6e6e6")
        self.Button1.configure(command=lambda: tpg_gui_support.tpg(
            self.axial_length.get(),
            self.filament_width_og.get(),
            self.printbed_diameter.get(),
            self.final_diameter.get(),
            self.helix_angle.get(),
            self.smear_factor.get(),
            self.flow_rate.get(),
            self.uv_offset.get(),
            self.use_strong_pattern.get()))
        self.Button1.configure(foreground="#000000")
        self.Button1.configure(highlightbackground="#e6e6e6")
        self.Button1.configure(highlightcolor="black")
        self.Button1.configure(relief=RAISED)
        self.Button1.configure(text='''Generate G Code''')

        self.menubar = Menu(top, font="TkMenuFont", bg=_bgcolor, fg=_fgcolor)
        top.configure(menu=self.menubar)