def __init__(self, messageManagerWindow):
        self.frame = Frame(messageManagerWindow.master)
        self.window = messageManagerWindow

        self.okButton = HoverButton(self.frame, text="OK", width=10, bd=2, relief=GROOVE, command=lambda: self.updateMessages())
        self.okButton.grid(row=0, column=0, sticky=E, padx=10)

        self.cancelButton = HoverButton(self.frame, text="Cancel", width=10, bd=2, relief=GROOVE, command=lambda: self.cancel())
        self.cancelButton.grid(row=0, column=1, sticky=E)
Esempio n. 2
0
class OkCancelFrame:
    def __init__(self, window):
        self.window = window
        self.frame = Frame(self.window.master)

        self.okButton = HoverButton(
            self.frame,
            text="OK",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.updateCurrentSettings())
        self.okButton.grid(row=0, column=0, sticky=E, padx=10)

        self.cancelButton = HoverButton(
            self.frame,
            text="Cancel",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.window.master.destroy())
        self.cancelButton.grid(row=0, column=1, sticky=E)

    def validateBeforeSaving(self):
        return validateWindowSettings.validate(self.window.fields, self.window.master) \
               and validateMessageSettings.validate(self.window.fields, self.window.master) \
               and validateFontSettings.validate(self.window.fields, self.window.master)

    def updateCurrentSettings(self):
        if self.validateBeforeSaving():
            windowSettings = WindowSettings(
                self.window.fields.VAR_ENTRY_MOVE_ALL_ON_LINE_DELAY.get(),
                self.window.fields.VAR_PATH_WINDOW_BG_IMAGE.get(),
                self.window.fields.VAR_WINDOW_WIDTH.get(),
                self.window.fields.VAR_WINDOW_HEIGHT.get(),
                self.window.fields.VAR_LABEL_WINDOW_BG_COLOR_TEXT.get(),
                self.window.fields.VAR_MESSAGE_SHUFFLE.get())
            messageSettings = MessageSettings(
                self.window.mFrame.LABEL_MESSAGE_COLOR.cget("text"),
                self.window.fields.VAR_FONT_COMBO_BOX.get(),
                self.window.fields.VAR_ENTRY_MESSAGE_INTERMISSION.get(),
                self.window.fields.VAR_ENTRY_NORMAL_FONT_SIZE.get(),
                self.window.fields.VAR_ENTRY_MESSAGE_DURATION.get(),
                self.window.fields.VAR_ARRIVAL.get(),
                self.window.fields.VAR_DEPARTURE.get(),
                self.window.fields.VAR_FONT_IS_BOLD.get(),
                self.window.fields.VAR_FONT_IS_ITALIC.get(),
                self.window.fields.VAR_FONT_IS_OVERSTRIKE.get(),
                self.window.fields.VAR_ALIGNMENT.get())
            self.window.parent.settings = Settings(windowSettings,
                                                   messageSettings)
            self.window.parent.applyCurrentWindowSettings()
            self.window.master.destroy()
class MessageOkCancelFrame:
    def __init__(self, messageManagerWindow):
        self.frame = Frame(messageManagerWindow.master)
        self.window = messageManagerWindow

        self.okButton = HoverButton(self.frame, text="OK", width=10, bd=2, relief=GROOVE, command=lambda: self.updateMessages())
        self.okButton.grid(row=0, column=0, sticky=E, padx=10)

        self.cancelButton = HoverButton(self.frame, text="Cancel", width=10, bd=2, relief=GROOVE, command=lambda: self.cancel())
        self.cancelButton.grid(row=0, column=1, sticky=E)

    def updateMessages(self):
        for message in self.window.messages:
            message.sortOrder = self.window.messages.index(message) + 1
        self.window.window.messages = self.window.messages
        self.window.master.destroy()

    def cancel(self):
        self.window.window.messages = self.window.cancelMessages
        self.window.master.destroy()
Esempio n. 4
0
    def __init__(self, messageComponentWindow):
        self.frame = Frame(messageComponentWindow.master)
        self.window = messageComponentWindow

        self.okButton = HoverButton(
            self.frame,
            text="OK",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.window.returnMessageComponent())
        self.okButton.grid(row=0, column=0, sticky=E, padx=10)

        self.cancelButton = HoverButton(
            self.frame,
            text="Cancel",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.window.master.destroy())
        self.cancelButton.grid(row=0, column=1, sticky=E)
Esempio n. 5
0
    def __init__(self, window):
        self.window = window
        self.frame = Frame(self.window.master)

        self.okButton = HoverButton(
            self.frame,
            text="OK",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.updateCurrentSettings())
        self.okButton.grid(row=0, column=0, sticky=E, padx=10)

        self.cancelButton = HoverButton(
            self.frame,
            text="Cancel",
            width=10,
            bd=2,
            relief=GROOVE,
            command=lambda: self.window.master.destroy())
        self.cancelButton.grid(row=0, column=1, sticky=E)
class MessageComponentFrame:
    def __init__(self, parent):
        self.parent = parent
        self.frame = Frame(parent.master, bd=2, relief=GROOVE)

        self.textValue = StringVar()
        self.imageValue = StringVar()
        self.imagePath = StringVar()
        self.fileValue = StringVar()
        self.filePath = StringVar()
        self.gapValue = StringVar()
        self.componentType = StringVar()
        self.componentTypes = ["Text", "Image", "Text From File", "Pixel Gap"]

        labelMessageSettings = Label(self.frame, text="Component Settings")
        labelMessageSettings.grid(row=0,
                                  column=0,
                                  sticky=W,
                                  columnspan=3,
                                  padx=1,
                                  pady=1)

        labelComponentType = Label(self.frame, text="Component Type:")
        labelComponentType.grid(row=1, column=0, sticky=E, padx=4, pady=4)
        self.comboboxComponentType = Combobox(self.frame,
                                              values=self.componentTypes,
                                              textvariable=self.componentType,
                                              state="readonly")

        self.comboboxComponentType.grid(row=1,
                                        column=1,
                                        columnspan=2,
                                        sticky=W,
                                        padx=4,
                                        pady=4)

        self.labelTextToDisplay = Label(self.frame, text="Text to Display:")
        self.labelTextToDisplay.grid(row=2, column=0, sticky=E, padx=4, pady=4)
        self.inputTextToDisplay = Entry(self.frame,
                                        textvariable=self.textValue,
                                        width=40)
        self.inputTextToDisplay.grid(row=2,
                                     column=1,
                                     columnspan=2,
                                     sticky=W,
                                     padx=4,
                                     pady=4)

        self.labelImage = Label(self.frame,
                                textvariable=self.imagePath,
                                anchor=W)
        self.buttonImage = HoverButton(self.frame,
                                       text='Select File',
                                       command=lambda: self.selectImageFile(),
                                       width=12)
        self.buttonImage.grid(row=3, column=0, sticky=E, padx=4, pady=4)
        self.labelImage.grid(row=3, column=1, columnspan=2, sticky=W)

        self.labelFile = Label(self.frame,
                               textvariable=self.filePath,
                               anchor=W)
        self.buttonFile = HoverButton(self.frame,
                                      text='Select File',
                                      command=lambda: self.selectTextFile(),
                                      width=12)
        self.buttonFile.grid(row=4, column=0, sticky=E, padx=4, pady=4)
        self.labelFile.grid(row=4, column=1, columnspan=2, sticky=W)

        self.labelGap = Label(self.frame, text="Width of Gap:")
        self.labelGap.grid(row=5, column=0, sticky=E, padx=4, pady=(4, 0))
        self.gapFrame = Frame(self.frame)
        self.inputGap = Entry(self.gapFrame,
                              textvariable=self.gapValue,
                              width=4)
        self.inputGap.grid(row=0, column=0, sticky=W, pady=4)
        self.labelGapPixels = Label(self.gapFrame, text="pixels")
        self.labelGapPixels.grid(row=0, column=1, padx=2, sticky=W)
        self.gapFrame.grid(row=5,
                           column=1,
                           columnspan=2,
                           sticky=W,
                           padx=4,
                           pady=4)

        self.comboboxComponentType.bind("<<ComboboxSelected>>",
                                        self.updateGrid)
        self.setFields()
        self.updateGrid(None)

    def setFields(self):
        mp = self.parent.messagePart
        if mp:
            self.comboboxComponentType.set(mp.partType)
            if mp.partType == "Text":
                self.textValue.set(mp.value)
            elif mp.partType == "Image":
                self.imagePath.set(helperMethods.getFileNameFromPath(mp.value))
                self.imageValue.set(mp.value)
            elif mp.partType == "Text From File":
                self.filePath.set(helperMethods.getFileNameFromPath(mp.value))
                self.fileValue.set(mp.value)
            elif mp.partType == "Pixel Gap":
                self.gapValue.set(mp.value)
        else:
            self.comboboxComponentType.set("Text")

    def hideAllDropdownDependentFields(self):
        self.labelTextToDisplay.grid_remove()
        self.inputTextToDisplay.grid_remove()
        self.labelImage.grid_remove()
        self.buttonImage.grid_remove()
        self.labelFile.grid_remove()
        self.buttonFile.grid_remove()
        self.labelGap.grid_remove()
        self.gapFrame.grid_remove()

    def displayCurrentComponentTypeDependencies(self):
        if self.componentType.get() == "Text":
            self.labelTextToDisplay.grid()
            self.inputTextToDisplay.grid()
        elif self.componentType.get() == "Image":
            self.labelImage.grid()
            self.buttonImage.grid()
        elif self.componentType.get() == "Text From File":
            self.labelFile.grid()
            self.buttonFile.grid()
        elif self.componentType.get() == "Pixel Gap":
            self.labelGap.grid()
            self.gapFrame.grid()

    def updateGrid(self, e):
        self.hideAllDropdownDependentFields()
        self.displayCurrentComponentTypeDependencies()

    def selectImageFile(self):
        filename = filedialog.askopenfilename(
            initialdir=os.getcwd() + "/imagefiles",
            title="Select image file",
            filetypes=[("PNG", "*.png"),
                       ("JPEG", "*.jpg; *.jpeg; *.jpe; *.jfif")])
        if filename:
            self.imagePath.set(helperMethods.getFileNameFromPath(filename))
            self.imageValue.set(filename)

    def selectTextFile(self):
        filename = filedialog.askopenfilename(initialdir=os.getcwd(),
                                              title="Select text file",
                                              filetypes=[("txt files", "*.txt")
                                                         ])
        if filename:
            self.filePath.set(helperMethods.getFileNameFromPath(filename))
            self.fileValue.set(filename)

    def getValue(self):
        if self.componentType.get() == "Text":
            return self.textValue.get()
        elif self.componentType.get() == "Image":
            return self.imageValue.get()
        elif self.componentType.get() == "Text From File":
            return self.fileValue.get()
        elif self.componentType.get() == "Pixel Gap":
            return self.gapValue.get()
    def __init__(self, parent):
        self.parent = parent
        self.frame = Frame(parent.master, bd=2, relief=GROOVE)

        self.textValue = StringVar()
        self.imageValue = StringVar()
        self.imagePath = StringVar()
        self.fileValue = StringVar()
        self.filePath = StringVar()
        self.gapValue = StringVar()
        self.componentType = StringVar()
        self.componentTypes = ["Text", "Image", "Text From File", "Pixel Gap"]

        labelMessageSettings = Label(self.frame, text="Component Settings")
        labelMessageSettings.grid(row=0,
                                  column=0,
                                  sticky=W,
                                  columnspan=3,
                                  padx=1,
                                  pady=1)

        labelComponentType = Label(self.frame, text="Component Type:")
        labelComponentType.grid(row=1, column=0, sticky=E, padx=4, pady=4)
        self.comboboxComponentType = Combobox(self.frame,
                                              values=self.componentTypes,
                                              textvariable=self.componentType,
                                              state="readonly")

        self.comboboxComponentType.grid(row=1,
                                        column=1,
                                        columnspan=2,
                                        sticky=W,
                                        padx=4,
                                        pady=4)

        self.labelTextToDisplay = Label(self.frame, text="Text to Display:")
        self.labelTextToDisplay.grid(row=2, column=0, sticky=E, padx=4, pady=4)
        self.inputTextToDisplay = Entry(self.frame,
                                        textvariable=self.textValue,
                                        width=40)
        self.inputTextToDisplay.grid(row=2,
                                     column=1,
                                     columnspan=2,
                                     sticky=W,
                                     padx=4,
                                     pady=4)

        self.labelImage = Label(self.frame,
                                textvariable=self.imagePath,
                                anchor=W)
        self.buttonImage = HoverButton(self.frame,
                                       text='Select File',
                                       command=lambda: self.selectImageFile(),
                                       width=12)
        self.buttonImage.grid(row=3, column=0, sticky=E, padx=4, pady=4)
        self.labelImage.grid(row=3, column=1, columnspan=2, sticky=W)

        self.labelFile = Label(self.frame,
                               textvariable=self.filePath,
                               anchor=W)
        self.buttonFile = HoverButton(self.frame,
                                      text='Select File',
                                      command=lambda: self.selectTextFile(),
                                      width=12)
        self.buttonFile.grid(row=4, column=0, sticky=E, padx=4, pady=4)
        self.labelFile.grid(row=4, column=1, columnspan=2, sticky=W)

        self.labelGap = Label(self.frame, text="Width of Gap:")
        self.labelGap.grid(row=5, column=0, sticky=E, padx=4, pady=(4, 0))
        self.gapFrame = Frame(self.frame)
        self.inputGap = Entry(self.gapFrame,
                              textvariable=self.gapValue,
                              width=4)
        self.inputGap.grid(row=0, column=0, sticky=W, pady=4)
        self.labelGapPixels = Label(self.gapFrame, text="pixels")
        self.labelGapPixels.grid(row=0, column=1, padx=2, sticky=W)
        self.gapFrame.grid(row=5,
                           column=1,
                           columnspan=2,
                           sticky=W,
                           padx=4,
                           pady=4)

        self.comboboxComponentType.bind("<<ComboboxSelected>>",
                                        self.updateGrid)
        self.setFields()
        self.updateGrid(None)
Esempio n. 8
0
    def __init__(self, messageMakerPartFrame):
        self.frame = Frame(messageMakerPartFrame.frame)
        self.window = messageMakerPartFrame.parent
        self.messageMakerPartFrame = messageMakerPartFrame

        ROW_UP = 0
        ROW_DOWN = 1
        ROW_ADD = 2
        ROW_EDIT = 3
        ROW_COPY = 4
        ROW_DELETE = 5
        BUTTON_WIDTH = 10
        BUTTON_BORDER = 2
        COLUMN = 0
        PADY = 4

        self.upButton = HoverButton(self.frame,
                                    text="Move Up",
                                    width=BUTTON_WIDTH,
                                    bd=BUTTON_BORDER,
                                    relief=GROOVE,
                                    command=lambda: self.messageMakerPartFrame.
                                    listFrame.moveSelectedUp())
        self.upButton.grid(row=ROW_UP, column=COLUMN, pady=(1, 4))

        self.downButton = HoverButton(
            self.frame,
            text="Move Down",
            width=BUTTON_WIDTH,
            bd=BUTTON_BORDER,
            relief=GROOVE,
            command=lambda: self.messageMakerPartFrame.listFrame.
            moveSelectedDown())
        self.downButton.grid(row=ROW_DOWN, column=COLUMN, pady=PADY)

        self.addButton = HoverButton(
            self.frame,
            text="New",
            width=BUTTON_WIDTH,
            bd=BUTTON_BORDER,
            relief=GROOVE,
            command=lambda: self.messageMakerPartFrame.listFrame.
            getMessageComponentWindow(False))
        self.addButton.grid(row=ROW_ADD, column=COLUMN, pady=PADY)

        self.editButton = HoverButton(
            self.frame,
            text="Edit",
            width=BUTTON_WIDTH,
            bd=BUTTON_BORDER,
            relief=GROOVE,
            command=lambda: self.messageMakerPartFrame.listFrame.
            getMessageComponentWindow(True))
        self.editButton.grid(row=ROW_EDIT, column=COLUMN, pady=PADY)

        self.copyButton = HoverButton(
            self.frame,
            text="Copy",
            width=BUTTON_WIDTH,
            bd=BUTTON_BORDER,
            relief=GROOVE,
            command=lambda: self.messageMakerPartFrame.listFrame.copySelected(
            ))
        self.copyButton.grid(row=ROW_COPY, column=COLUMN, pady=PADY)

        self.deleteButton = HoverButton(
            self.frame,
            text="Delete",
            width=BUTTON_WIDTH,
            bd=BUTTON_BORDER,
            relief=GROOVE,
            command=lambda: self.messageMakerPartFrame.listFrame.
            deleteSelected())
        self.deleteButton.grid(row=ROW_DELETE, column=COLUMN, pady=PADY)
Esempio n. 9
0
    def __init__(self, master, fields):
        self.frame = Frame(master, bd=2, relief=GROOVE)
        self.fields = fields

        self.fields.VAR_FONT_COMBO_BOX.trace('w', self.updateFontPreview)

        ROW_MESSAGE_SETTINGS = 0
        ROW_MESSAGE_DURATION = 1
        ROW_MESSAGE_INTERMISSION = 2
        ROW_MESSAGE_SPEED = 3
        ROW_FONT = 4
        ROW_NORMAL_FONT_SIZE = 5
        ROW_FONT_STYLE = 6
        ROW_MESSAGE_COLOR = 7
        ROW_ALIGNMENT = 8
        ROW_ARRIVAL = 9
        ROW_DEPARTURE = 10
        ROW_FONT_PREVIEW = 11

        Label(self.frame,
              text="Global Message Settings").grid(row=ROW_MESSAGE_SETTINGS,
                                                   column=0,
                                                   columnspan=3,
                                                   sticky=W,
                                                   pady=1)
        self.LABEL_MESSAGE_DURATION = Label(self.frame,
                                            text="Show Message For:")
        self.LABEL_MESSAGE_DURATION.grid(row=ROW_MESSAGE_DURATION,
                                         column=0,
                                         sticky=E,
                                         pady=1)
        messageDurationFrame = Frame(self.frame)
        self.ENTRY_MESSAGE_DURATION = Entry(
            messageDurationFrame,
            textvariable=self.fields.VAR_ENTRY_MESSAGE_DURATION,
            width=4)
        self.ENTRY_MESSAGE_DURATION.grid(row=0, column=0, sticky=W, pady=1)
        Label(messageDurationFrame, text="seconds").grid(row=0,
                                                         column=1,
                                                         sticky=W,
                                                         pady=1)
        messageDurationFrame.grid(row=ROW_MESSAGE_DURATION,
                                  column=1,
                                  sticky=W,
                                  pady=1)

        self.LABEL_MESSAGE_INTERMISSION = Label(
            self.frame, text="Pause After Message For:")
        self.LABEL_MESSAGE_INTERMISSION.grid(row=ROW_MESSAGE_INTERMISSION,
                                             column=0,
                                             sticky=E,
                                             pady=1)
        messageIntermissionFrame = Frame(self.frame)
        self.ENTRY_MESSAGE_INTERMISSION = Entry(
            messageIntermissionFrame,
            textvariable=self.fields.VAR_ENTRY_MESSAGE_INTERMISSION,
            width=4)
        self.ENTRY_MESSAGE_INTERMISSION.grid(row=0, column=0, sticky=W, pady=1)
        Label(messageIntermissionFrame, text="seconds").grid(row=0,
                                                             column=1,
                                                             sticky=W,
                                                             pady=1)
        messageIntermissionFrame.grid(row=ROW_MESSAGE_INTERMISSION,
                                      column=1,
                                      sticky=W,
                                      pady=1)

        self.LABEL_MESSAGE_FONT_FACE = Label(self.frame, text="Message Font:")
        self.LABEL_MESSAGE_FONT_FACE.grid(row=ROW_FONT,
                                          column=0,
                                          sticky=E,
                                          pady=1)
        self.FONT_FAMILIES = sorted([f for f in font.families()])
        self.FONT_COMBO_BOX = ttk.Combobox(
            self.frame,
            values=self.FONT_FAMILIES,
            textvariable=self.fields.VAR_FONT_COMBO_BOX,
            state="readonly")
        self.FONT_COMBO_BOX.grid(row=ROW_FONT, column=1, sticky=W, pady=1)

        self.BUTTON_MESSAGE_COLOR = HoverButton(
            self.frame,
            text='Font Color:',
            command=lambda: self.updateMessageColor())
        self.BUTTON_MESSAGE_COLOR.grid(row=ROW_MESSAGE_COLOR,
                                       column=0,
                                       sticky=E,
                                       padx=4,
                                       pady=1)

        messageColorFrame = Frame(self.frame)
        self.CANVAS_MESSAGE_COLOR = Canvas(messageColorFrame,
                                           width=80,
                                           height=30)
        self.RECTANGLE_MESSAGE_COLOR = self.CANVAS_MESSAGE_COLOR.create_rectangle(
            80,
            4,
            0,
            30,
            fill=self.fields.VAR_LABEL_MESSAGE_COLOR_FOREGROUND,
            outline="")
        self.CANVAS_MESSAGE_COLOR.grid(row=0, column=0, sticky=W, pady=1)
        self.LABEL_MESSAGE_COLOR = Label(
            messageColorFrame,
            textvariable=self.fields.VAR_LABEL_MESSAGE_COLOR_TEXT)
        self.LABEL_MESSAGE_COLOR.grid(row=0, column=1, sticky=W, pady=1)
        messageColorFrame.grid(row=ROW_MESSAGE_COLOR,
                               column=1,
                               sticky=W,
                               pady=1)

        self.LABEL_NORMAL_FONT_SIZE = Label(self.frame, text="Font Size:")
        self.LABEL_NORMAL_FONT_SIZE.grid(row=ROW_NORMAL_FONT_SIZE,
                                         column=0,
                                         sticky=E,
                                         pady=1)
        self.ENTRY_NORMAL_FONT_SIZE = Entry(
            self.frame,
            textvariable=self.fields.VAR_ENTRY_NORMAL_FONT_SIZE,
            width=4)
        self.ENTRY_NORMAL_FONT_SIZE.grid(row=ROW_NORMAL_FONT_SIZE,
                                         column=1,
                                         sticky=W,
                                         pady=1)

        self.LABEL_FONT_STYLE = Label(self.frame, text="Font Style:")
        self.LABEL_FONT_STYLE.grid(row=ROW_FONT_STYLE,
                                   column=0,
                                   sticky=NE,
                                   pady=1)

        self.fontStyleFrame = Frame(self.frame)
        self.checkButtonBold = Checkbutton(
            self.fontStyleFrame,
            borderwidth=0,
            text="Bold",
            variable=self.fields.VAR_FONT_IS_BOLD,
            command=lambda: self.updateFontPreview(None, None, None))
        self.checkButtonBold.grid(row=0, padx=1, sticky=W)
        self.checkButtonItalic = Checkbutton(
            self.fontStyleFrame,
            borderwidth=0,
            text="Italic",
            variable=self.fields.VAR_FONT_IS_ITALIC,
            command=lambda: self.updateFontPreview(None, None, None))
        self.checkButtonItalic.grid(row=1, padx=1, sticky=W)
        self.checkButtonOverstrike = Checkbutton(
            self.fontStyleFrame,
            borderwidth=0,
            text="Strikethrough",
            variable=self.fields.VAR_FONT_IS_OVERSTRIKE,
            command=lambda: self.updateFontPreview(None, None, None))
        self.checkButtonOverstrike.grid(row=2, padx=1, sticky=W)
        self.fontStyleFrame.grid(row=ROW_FONT_STYLE,
                                 column=1,
                                 sticky=W,
                                 pady=1)

        self.LABEL_MOVE_ALL_ON_LINE_DELAY = Label(self.frame,
                                                  text="Message Scroll Speed:")
        self.LABEL_MOVE_ALL_ON_LINE_DELAY.grid(row=ROW_MESSAGE_SPEED,
                                               column=0,
                                               sticky=E,
                                               pady=1)
        moveAllOnLineDelayFrame = Frame(self.frame)
        self.entryMoveAllOnLineDelay = Entry(
            moveAllOnLineDelayFrame,
            textvariable=self.fields.VAR_ENTRY_MOVE_ALL_ON_LINE_DELAY,
            width=4)
        self.entryMoveAllOnLineDelay.grid(row=ROW_MESSAGE_SPEED,
                                          column=0,
                                          sticky=W,
                                          pady=1)
        Label(moveAllOnLineDelayFrame,
              text="(1-100)").grid(row=ROW_MESSAGE_SPEED,
                                   column=1,
                                   sticky=W,
                                   pady=1)
        moveAllOnLineDelayFrame.grid(row=ROW_MESSAGE_SPEED,
                                     column=1,
                                     sticky=W,
                                     pady=1)

        self.ALIGNMENT_OPTIONS = ["Left", "Center", "Right"]
        self.ARRIVAL_ANIMATIONS = [
            "Pick For Me", "Slide Right", "Slide Left", "Slide Up",
            "Slide Down", "Zip Forward", "Zip Backward", "Zip Randomly"
        ]
        self.DEPARTURE_ANIMATIONS = [
            "Pick For Me", "Slide Right", "Slide Left", "Slide Up",
            "Slide Down", "Unzip Forward", "Unzip Backward", "Unzip Randomly"
        ]

        self.LABEL_ALIGNMENT = Label(self.frame, text="Message Alignment:")
        self.LABEL_ALIGNMENT.grid(row=ROW_ALIGNMENT,
                                  column=0,
                                  sticky=E,
                                  pady=1)
        self.ALIGNMENT_COMBO_BOX = ttk.Combobox(
            self.frame,
            values=self.ALIGNMENT_OPTIONS,
            textvariable=self.fields.VAR_ALIGNMENT,
            state="readonly")
        self.ALIGNMENT_COMBO_BOX.grid(row=ROW_ALIGNMENT,
                                      column=1,
                                      sticky=W,
                                      pady=1,
                                      padx=(0, 4))

        self.LABEL_ARRIVAL = Label(self.frame, text="Arrival Animation:")
        self.LABEL_ARRIVAL.grid(row=ROW_ARRIVAL, column=0, sticky=E, pady=1)
        self.ARRIVAL_COMBO_BOX = ttk.Combobox(
            self.frame,
            values=self.ARRIVAL_ANIMATIONS,
            textvariable=self.fields.VAR_ARRIVAL,
            state="readonly")
        self.ARRIVAL_COMBO_BOX.grid(row=ROW_ARRIVAL,
                                    column=1,
                                    sticky=W,
                                    pady=1,
                                    padx=(0, 4))

        self.LABEL_DEPARTURE = Label(self.frame, text="Departure Animation:")
        self.LABEL_DEPARTURE.grid(row=ROW_DEPARTURE,
                                  column=0,
                                  sticky=E,
                                  pady=1)
        self.DEPARTURE_COMBO_BOX = ttk.Combobox(
            self.frame,
            values=self.DEPARTURE_ANIMATIONS,
            textvariable=self.fields.VAR_DEPARTURE,
            state="readonly")
        self.DEPARTURE_COMBO_BOX.grid(row=ROW_DEPARTURE,
                                      column=1,
                                      sticky=W,
                                      pady=(1, 4))

        self.LABEL_FONT_PREVIEW = Label(self.frame,
                                        text="Font Preview, Size 12",
                                        font=self.fields.VAR_FONT_COMBO_BOX,
                                        borderwidth=2,
                                        relief=GROOVE)
        self.LABEL_FONT_PREVIEW.grid(row=ROW_FONT_PREVIEW,
                                     column=0,
                                     columnspan=2,
                                     sticky=EW,
                                     pady=(1, 0))
        self.updateFontPreview(None, None, None)
Esempio n. 10
0
    def __init__(self, parent, fields: SettingsGUIFields):
        self.frame = Frame(parent.master, bd=2, relief=GROOVE)
        self.parent = parent
        self.fields = fields

        self.dimensionCheckbutton = BooleanVar()
        self.doNotUseBgCheckbutton = BooleanVar()

        if self.fields.VAR_PATH_WINDOW_BG_IMAGE == "":
            self.doNotUseBgCheckbutton.set(True)

        ROW_BG_SETTINGS = 0
        ROW_BG_COLOR = 1
        ROW_BG_IMAGE = 2
        ROW_SET_DIMENSIONS = 3
        ROW_DO_NOT_USE_BG = 4

        bgColorFrame = Frame(self.frame)

        self.LABEL_WINDOW_BG_COLOR = Label(
            bgColorFrame, textvariable=fields.VAR_LABEL_WINDOW_BG_COLOR_TEXT)
        Label(self.frame, text="Background Settings").grid(row=ROW_BG_SETTINGS,
                                                           column=0,
                                                           sticky=W)

        self.BUTTON_WINDOW_BG_COLOR = HoverButton(
            self.frame,
            text='Background Color:',
            width=15,
            command=lambda: self.updateWindowColor(fields))
        self.BUTTON_WINDOW_BG_COLOR.grid(row=ROW_BG_COLOR,
                                         column=0,
                                         sticky=E,
                                         padx=4)

        self.LABEL_WINDOW_BG_COLOR.grid(row=0, column=1, sticky=W)

        self.LABEL_WINDOW_BG_IMAGE = Label(
            self.frame,
            textvariable=fields.VAR_DISPLAY_WINDOW_BG_IMAGE,
            width=20,
            anchor=W)

        self.BUTTON_WINDOW_BG_IMAGE = HoverButton(
            self.frame,
            text='Background Image:',
            width=15,
            command=lambda: self.selectImageFile(fields))
        self.BUTTON_WINDOW_BG_IMAGE.grid(row=ROW_BG_IMAGE,
                                         column=0,
                                         sticky=E,
                                         padx=4,
                                         pady=4)

        self.LABEL_WINDOW_BG_IMAGE.grid(row=ROW_BG_IMAGE, column=1, sticky=W)

        self.CANVAS_WINDOW_BG_IMAGE = Canvas(bgColorFrame, width=80, height=30)

        self.RECTANGLE_WINDOW_BG_IMAGE = self.CANVAS_WINDOW_BG_IMAGE.create_rectangle(
            80,
            4,
            0,
            30,
            fill=fields.VAR_LABEL_WINDOW_BG_COLOR_BACKGROUND,
            outline="")

        self.fitWindowFrame = Frame(self.frame)
        self.checkbuttonSetDimensions = Checkbutton(
            self.fitWindowFrame,
            text="Fit window to background image",
            variable=self.dimensionCheckbutton,
            command=lambda: self.updateWindowDimensions())
        self.checkbuttonSetDimensions.grid(row=0, column=0, sticky=W)
        self.fitWindowFrame.grid(row=ROW_SET_DIMENSIONS,
                                 column=0,
                                 columnspan=2,
                                 padx=4,
                                 pady=4,
                                 sticky=W)

        self.buttonClearImage = HoverButton(
            self.frame,
            text='Remove Image',
            width=15,
            command=lambda: self.updateBackgroundImage())
        self.buttonClearImage.grid(row=ROW_DO_NOT_USE_BG,
                                   column=0,
                                   columnspan=3,
                                   sticky=SE,
                                   padx=4,
                                   pady=(0, 4))

        self.CANVAS_WINDOW_BG_IMAGE.grid(row=0, column=0, sticky=W)
        bgColorFrame.grid(row=ROW_BG_COLOR, column=1, sticky=W)
Esempio n. 11
0
class SettingsBackgroundFrame:
    def __init__(self, parent, fields: SettingsGUIFields):
        self.frame = Frame(parent.master, bd=2, relief=GROOVE)
        self.parent = parent
        self.fields = fields

        self.dimensionCheckbutton = BooleanVar()
        self.doNotUseBgCheckbutton = BooleanVar()

        if self.fields.VAR_PATH_WINDOW_BG_IMAGE == "":
            self.doNotUseBgCheckbutton.set(True)

        ROW_BG_SETTINGS = 0
        ROW_BG_COLOR = 1
        ROW_BG_IMAGE = 2
        ROW_SET_DIMENSIONS = 3
        ROW_DO_NOT_USE_BG = 4

        bgColorFrame = Frame(self.frame)

        self.LABEL_WINDOW_BG_COLOR = Label(
            bgColorFrame, textvariable=fields.VAR_LABEL_WINDOW_BG_COLOR_TEXT)
        Label(self.frame, text="Background Settings").grid(row=ROW_BG_SETTINGS,
                                                           column=0,
                                                           sticky=W)

        self.BUTTON_WINDOW_BG_COLOR = HoverButton(
            self.frame,
            text='Background Color:',
            width=15,
            command=lambda: self.updateWindowColor(fields))
        self.BUTTON_WINDOW_BG_COLOR.grid(row=ROW_BG_COLOR,
                                         column=0,
                                         sticky=E,
                                         padx=4)

        self.LABEL_WINDOW_BG_COLOR.grid(row=0, column=1, sticky=W)

        self.LABEL_WINDOW_BG_IMAGE = Label(
            self.frame,
            textvariable=fields.VAR_DISPLAY_WINDOW_BG_IMAGE,
            width=20,
            anchor=W)

        self.BUTTON_WINDOW_BG_IMAGE = HoverButton(
            self.frame,
            text='Background Image:',
            width=15,
            command=lambda: self.selectImageFile(fields))
        self.BUTTON_WINDOW_BG_IMAGE.grid(row=ROW_BG_IMAGE,
                                         column=0,
                                         sticky=E,
                                         padx=4,
                                         pady=4)

        self.LABEL_WINDOW_BG_IMAGE.grid(row=ROW_BG_IMAGE, column=1, sticky=W)

        self.CANVAS_WINDOW_BG_IMAGE = Canvas(bgColorFrame, width=80, height=30)

        self.RECTANGLE_WINDOW_BG_IMAGE = self.CANVAS_WINDOW_BG_IMAGE.create_rectangle(
            80,
            4,
            0,
            30,
            fill=fields.VAR_LABEL_WINDOW_BG_COLOR_BACKGROUND,
            outline="")

        self.fitWindowFrame = Frame(self.frame)
        self.checkbuttonSetDimensions = Checkbutton(
            self.fitWindowFrame,
            text="Fit window to background image",
            variable=self.dimensionCheckbutton,
            command=lambda: self.updateWindowDimensions())
        self.checkbuttonSetDimensions.grid(row=0, column=0, sticky=W)
        self.fitWindowFrame.grid(row=ROW_SET_DIMENSIONS,
                                 column=0,
                                 columnspan=2,
                                 padx=4,
                                 pady=4,
                                 sticky=W)

        self.buttonClearImage = HoverButton(
            self.frame,
            text='Remove Image',
            width=15,
            command=lambda: self.updateBackgroundImage())
        self.buttonClearImage.grid(row=ROW_DO_NOT_USE_BG,
                                   column=0,
                                   columnspan=3,
                                   sticky=SE,
                                   padx=4,
                                   pady=(0, 4))

        self.CANVAS_WINDOW_BG_IMAGE.grid(row=0, column=0, sticky=W)
        bgColorFrame.grid(row=ROW_BG_COLOR, column=1, sticky=W)

    def updateBackgroundImage(self):
        self.fields.VAR_DISPLAY_WINDOW_BG_IMAGE.set("")
        self.fields.VAR_PATH_WINDOW_BG_IMAGE.set("")

    def updateWindowDimensions(self):
        if self.dimensionCheckbutton.get():
            try:
                filename = self.fields.VAR_PATH_WINDOW_BG_IMAGE.get()
                img = Image.open(filename)
                self.fields.VAR_WINDOW_WIDTH.set(img.size[0])
                self.fields.VAR_WINDOW_HEIGHT.set(img.size[1])

            except Exception:
                self.fields.VAR_WINDOW_WIDTH.set(0)
                self.fields.VAR_WINDOW_HEIGHT.set(0)
            self.parent.sFrame.ENTRY_WINDOW_WIDTH.configure(state=DISABLED)
            self.parent.sFrame.ENTRY_WINDOW_HEIGHT.configure(state=DISABLED)
        else:
            self.parent.sFrame.ENTRY_WINDOW_WIDTH.configure(state=NORMAL)
            self.parent.sFrame.ENTRY_WINDOW_HEIGHT.configure(state=NORMAL)

    def updateWindowColor(self, fields):
        color = colorchooser.askcolor(title="Select color")
        if color[1]:
            fields.VAR_LABEL_WINDOW_BG_COLOR_TEXT.set(color[1])
            fields.VAR_LABEL_WINDOW_BG_COLOR_BACKGROUND = color[1]
            self.CANVAS_WINDOW_BG_IMAGE.itemconfig(
                self.RECTANGLE_WINDOW_BG_IMAGE,
                fill=fields.VAR_LABEL_WINDOW_BG_COLOR_BACKGROUND)

    def selectImageFile(self, fields):
        filename = filedialog.askopenfilename(
            initialdir=os.getcwd() + "/imagefiles",
            title="Select image file",
            filetypes=[("PNG", "*.png"),
                       ("JPEG", "*.jpg; *.jpeg; *.jpe; *.jfif")])
        if filename:
            fields.VAR_DISPLAY_WINDOW_BG_IMAGE.set(
                helperMethods.getFileNameFromPath(filename))
            fields.VAR_PATH_WINDOW_BG_IMAGE.set(filename)
            self.updateWindowDimensions()
Esempio n. 12
0
    def __init__(self, parent):
        self.aboutWindow = Toplevel(parent)
        self.aboutWindow.withdraw()
        self.aboutWindow.geometry('+{x}+{y}'.format(x=parent.winfo_x(),
                                                    y=parent.winfo_y()))
        self.aboutWindow.wm_attributes("-topmost", 1)
        self.aboutWindow.focus_force()
        self.aboutWindow.iconbitmap("imagefiles/stIcon.ico")
        self.aboutWindow.title("About")
        self.aboutWindow.resizable(False, False)
        self.aboutWindow.grab_set()

        self.frameTop = Frame(self.aboutWindow)

        self.aboutImage = PhotoImage(file="imagefiles/stLogo64.png")
        self.aboutImageLabel = Label(self.frameTop,
                                     image=self.aboutImage,
                                     cursor="hand2")
        self.aboutImageLabel.bind(
            "<Button-1>",
            lambda x: webbrowser.open('https://www.go1den.com/streamticker',
                                      new=2))
        self.aboutImageLabel.grid(row=0, column=0, padx=4, pady=4)

        self.aboutLabel = Label(
            self.frameTop,
            text="StreamTicker\n\nVersion 2.0.7\n\nReleased: 5/4/2021",
            justify=LEFT)
        self.aboutLabel.grid(row=0, column=1, sticky=W, pady=4)

        self.frameTop.grid(row=0, column=0, sticky=W)

        self.aboutSupportLabel = Label(
            self.aboutWindow,
            text=
            "Hello. I'm Go1den. I developed StreamTicker.\nThis program is available to use for free.\nThat being said, I devoted many hours to it.\n\nPlease consider supporting me if you enjoy it:",
            justify=LEFT)
        self.aboutSupportLabel.grid(row=1,
                                    column=0,
                                    sticky=W,
                                    padx=4,
                                    columnspan=2)

        self.myPaypalImage = PhotoImage(file="imagefiles/donate.png")
        self.myPaypalButton = Label(self.aboutWindow,
                                    image=self.myPaypalImage,
                                    cursor="hand2")
        self.myPaypalButton.bind(
            "<Button-1>", lambda x: webbrowser.open(
                'https://www.paypal.com/donate/?hosted_button_id=LXMBXT59KL578',
                new=2))
        self.myPaypalButton.grid(row=2, column=0, columnspan=2, pady=4, padx=4)

        self.aboutThanksLabel = Label(
            self.aboutWindow,
            text=
            "Thank you so much for trying my program!\nIf you enjoy it, please tell others about it.",
            justify=LEFT)
        self.aboutThanksLabel.grid(row=3, column=0, sticky=W, pady=4, padx=4)

        self.okButton = HoverButton(self.aboutWindow,
                                    text="OK",
                                    width=10,
                                    bd=2,
                                    relief=GROOVE,
                                    command=lambda: self.aboutWindow.destroy())
        self.okButton.grid(row=4, column=0, sticky=SE, pady=4)

        self.aboutWindow.deiconify()
        self.aboutWindow.mainloop()