示例#1
0
def plugin_prefs(parent):
    global SERVER
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    nb.Label(frame, text="HITS Configuration").grid(padx=10,
                                                    row=8,
                                                    sticky=tk.W)

    nb.Label(frame, text="Server Address").grid(padx=10, row=10, sticky=tk.W)
    nb.Entry(frame, textvariable=SERVER).grid(padx=10,
                                              row=10,
                                              column=1,
                                              sticky=tk.EW)

    nb.Label(frame, text="Overlay Duration (sec)").grid(padx=10,
                                                        row=11,
                                                        sticky=tk.W)
    nb.Entry(frame, textvariable=OVERLAY_MESSAGE_DURATION).grid(padx=10,
                                                                row=11,
                                                                column=1,
                                                                sticky=tk.EW)

    nb.Label(frame, text="Traffic Reports (on/off)").grid(padx=10,
                                                          row=12,
                                                          sticky=tk.W)
    nb.Entry(frame, textvariable=OVERLAY_HITS_MODE).grid(padx=10,
                                                         row=12,
                                                         column=1,
                                                         sticky=tk.EW)

    return frame
示例#2
0
def plugin_prefs(parent, cmdr, is_beta):

    PADX = 10
    BUTTONX = 12  # indent Checkbuttons and Radiobuttons
    PADY = 2  # close spacing

    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    HyperlinkLabel(frame,
                   text='Elite Dangerous Star Map',
                   background=nb.Label().cget('background'),
                   url='https://www.edsm.net/',
                   underline=True).grid(columnspan=2, padx=PADX,
                                        sticky=tk.W)  # Don't translate
    this.log = tk.IntVar(value=config.getint('edsm_out') and 1)
    this.log_button = nb.Checkbutton(
        frame,
        text=_('Send flight log and Cmdr status to EDSM'),
        variable=this.log,
        command=prefsvarchanged)
    this.log_button.grid(columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)

    nb.Label(frame).grid(sticky=tk.W)  # big spacer
    this.label = HyperlinkLabel(frame,
                                text=_('Elite Dangerous Star Map credentials'),
                                background=nb.Label().cget('background'),
                                url='https://www.edsm.net/settings/api',
                                underline=True)  # Section heading in settings
    this.label.grid(columnspan=2, padx=PADX, sticky=tk.W)

    this.cmdr_label = nb.Label(frame, text=_('Cmdr'))  # Main window
    this.cmdr_label.grid(row=10, padx=PADX, sticky=tk.W)
    this.cmdr_text = nb.Label(frame)
    this.cmdr_text.grid(row=10, column=1, padx=PADX, pady=PADY, sticky=tk.W)

    this.user_label = nb.Label(frame, text=_('Commander Name'))  # EDSM setting
    this.user_label.grid(row=11, padx=PADX, sticky=tk.W)
    this.user = nb.Entry(frame)
    this.user.grid(row=11, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    this.apikey_label = nb.Label(frame, text=_('API Key'))  # EDSM setting
    this.apikey_label.grid(row=12, padx=PADX, sticky=tk.W)
    this.apikey = nb.Entry(frame)
    this.apikey.grid(row=12, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    prefs_cmdr_changed(cmdr, is_beta)

    return frame
示例#3
0
文件: load.py 项目: fiinnnn/EliteHIS
def plugin_prefs(parent, cmdr, is_beta):
    """
    Create settings dialog
    """
    frame = nb.Frame(parent)

    nb.Label(frame, text="Latitude").grid(row=0)
    nb.Entry(frame, textvariable=this.targetLat).grid(row=0, column=1)

    nb.Label(frame, text="Longitude").grid(row=1)
    nb.Entry(frame, textvariable=this.targetLong).grid(row=1, column=1)

    nb.Label(frame, text="Planet radius (in metres)").grid(row=2)
    nb.Entry(frame, textvariable=this.planetRadius).grid(row=2, column=1)
    return frame
示例#4
0
文件: load.py 项目: Dxnxsh/BGS-Tally
def plugin_prefs(parent, cmdr, is_beta):
    """
   Return a TK Frame for adding to the EDMC settings dialog.
   """

    frame = nb.Frame(parent)
    nb.Label(frame, text="Faction to monitor").grid(column=0, sticky=tk.W)
    factionname = nb.Entry(frame, textvariable=this.FactionName,
                           width=40).grid(column=0, sticky=tk.W)
    systemlabel = nb.Label(frame, text="System to monitor").grid(column=0,
                                                                 sticky=tk.W)
    systemname = nb.Entry(frame, textvariable=this.SystemName,
                          width=40).grid(column=0, sticky=tk.W)
    Reset = nb.Button(frame, text="Reset Counter").place(x=0, y=290)
    return frame
示例#5
0
def plugin_prefs(parent):
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    user_label = nb.Label(
            frame
            , text="User Name"
            )
    user_label.grid(
            padx=10
            , row=10
            , sticky=tk.W
            )

    user_entry = nb.Entry(
            frame
            , textvariable=this.user
            )
    user_entry.grid(
            padx=10
            , row=10
            , column=1
            , sticky=tk.EW
            )

    password_label = nb.Label(
            frame
            , text="Password"
            )
    password_label.grid(
            padx=10
            , row=12
            , sticky=tk.W
            )

    password_entry = nb.Entry(
            frame
            , textvariable=this.password
            , show=u'•'
            )
    password_entry.grid(
            padx=10
            , row=12
            , column=1
            , sticky=tk.EW
            )

    return frame
示例#6
0
def plugin_prefs(parent):
    """
    Handle plugin tab
    :param parent:
    :return:
    """
    PADX = 10
    PADY = 2

    ROW0 = 8
    ROW1 = 10
    ROW2 = 12
    ROW3 = 14

    BUTTONX = 12

    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    nb.Label(frame, text=APP_LONGNAME).grid(padx=PADX, row=ROW0, sticky=tk.W)

    nb.Label(frame, text=TTL_LABEL) \
        .grid(padx=PADX, pady=PADY, row=ROW1, sticky=tk.W)
    nb.Entry(frame, textvariable=TTL_FIELD) \
        .grid(padx=PADX, pady=PADY, row=ROW1, column=1, sticky=tk.EW)

    nb.Label(frame, text=ED_DATE_LABEL) \
        .grid(padx=PADX, pady=PADY, row=ROW2, sticky=tk.W)
    nb.Checkbutton(frame, text='Use Elite time or normal UTC time', variable=ED_DATE_FIELD) \
        .grid(padx=PADX, pady=PADY, row=ROW2, column=1, sticky=tk.W)

    return frame
示例#7
0
def plugin_prefs(parent, cmdr, is_beta):
    """
    Return a TK Frame for adding to the EDMC settings dialog.
    """
    PADX = 5
    PADY = 2

    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    def select_route_file_handler():
        """
        Handle Select Route File button click event
        """
        file_selection = tkFileDialog.askopenfilename(filetypes=[("Supported files","*.csv *.txt"),("CSV files","*.csv"),("Text files","*.txt"),("All files","*.*")])
        if file_selection:
            this.route_file_location_setting.set(file_selection)
            load_systems()


    def clear_route_file_handler():
        """
        Handle Clear Route File button click event
        """
        this.route_file_location_setting.set("")
        load_systems()

    nb.Label(frame, text="Route File Location: ").grid(row=0, padx=PADX, pady=PADY, sticky=tk.E)
    nb.Entry(frame, textvariable=this.route_file_location_setting).grid(row=0, column=1, sticky=tk.EW)
    nb.Button(frame, text="Select Route File", command=select_route_file_handler).grid(row=0, column=2, columnspan=2, padx=PADX, pady=PADY, sticky=tk.EW)
    nb.Button(frame, text="Clear Route File", command=clear_route_file_handler).grid(row=1, column=2, columnspan=2, padx=PADX, pady=PADY, sticky=tk.EW)
    nb.Label(frame, text="Route: ").grid(row=2, padx=PADX, pady=PADY, sticky=tk.NE)
    nb.Label(frame, textvariable=this.systems_label_text).grid(row=2, column=1, columnspan=2, sticky=tk.EW)

    return frame
示例#8
0
def plugin_prefs(parent):
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    username_label = nb.Label(
        frame, text="Nazwa użytkownika na forum The Winged Hussars")
    username_label.grid(padx=10, row=10, sticky=tk.W)

    username_entry = nb.Entry(frame, textvariable=this.username)
    username_entry.grid(padx=10, row=10, column=1, sticky=tk.EW)

    pass_label = nb.Label(frame, text="Klucz API wygenerowany w profilu forum")
    pass_label.grid(padx=10, row=12, sticky=tk.W)

    pass_entry = nb.Entry(frame, textvariable=this.apikey)
    pass_entry.grid(padx=10, row=12, column=1, sticky=tk.EW)

    return frame
示例#9
0
def plugin_prefs(parent):
    global CONFIG
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    nb.Label(frame, text="NULL Tracker Configuration").grid(padx=10, row=8, sticky=tk.W)

    nb.Label(frame, text="NULL Tracker Server").grid(padx=10, row=10, sticky=tk.W)
    nb.Entry(frame, textvariable=CONFIG.server).grid(padx=10, row=10, column=1, sticky=tk.EW)

    nb.Label(frame, text="NULL Tracker API Key").grid(padx=10, row=11, sticky=tk.W)
    nb.Entry(frame, textvariable=CONFIG.apikey).grid(padx=10, row=11, column=1, sticky=tk.EW)

    nb.Label(frame, text="Status             ").grid(padx=10, row=12, sticky=tk.W)
    nb.Label(frame, textvariable=CONFIG.status).grid(padx=10, row=12, column=1, sticky=tk.EW)
    nb.Label(frame, textvariable=CONFIG.uploads).grid(padx=10, row=13, column=1, sticky=tk.EW)

    return frame
示例#10
0
def plugin_prefs(parent):
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    site_label = nb.Label(frame, text="EDStats Configuration")
    site_label.grid(padx=10, row=8, sticky=tk.W)

    email_label = nb.Label(frame, text="EDStats Email")
    email_label.grid(padx=10, row=10, sticky=tk.W)

    email_entry = nb.Entry(frame, textvariable=this.email)
    email_entry.grid(padx=10, row=10, column=1, sticky=tk.EW)

    pass_label = nb.Label(frame, text="EDStats API Key")
    pass_label.grid(padx=10, row=12, sticky=tk.W)

    pass_entry = nb.Entry(frame, textvariable=this.key)
    pass_entry.grid(padx=10, row=12, column=1, sticky=tk.EW)

    return frame
示例#11
0
def plugin_prefs(parent,cmdr,is_beta):  
	frame = nb.Frame(parent)
	frame.columnconfigure(1, weight=1)

	mySetting_label = nb.Label(frame, text="Need a reset button")
	mySetting_label.grid(padx=10, row=10, sticky=tk.W)

	mySetting_entry = nb.Entry(frame, textvariable=this.mySetting)
	mySetting_entry.grid(padx=10, row=10, column=1, sticky=tk.EW)
		
	return frame
示例#12
0
def plugin_prefs(parent):
    global SERVER
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    nb.Label(frame, text="HITS Configuration").grid(padx=10, row=8, sticky=tk.W)

    nb.Label(frame, text="Server Address").grid(padx=10, row=10, sticky=tk.W)
    nb.Entry(frame, textvariable=SERVER).grid(padx=10, row=10, column=1, sticky=tk.EW)

    return frame
示例#13
0
def plugin_prefs(parent, cmdr, is_beta):
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    stm_label = nb.Label(frame, text="Screenshot Directory")
    stm_label.grid(padx=10, row=10, sticky=tk.W)

    stm_entry = nb.Entry(frame, textvariable=this.stm_loc)
    stm_entry.grid(padx=10, row=10, column=1, sticky=tk.EW)

    png_label = nb.Label(frame, text="Conversion Directory")
    png_label.grid(padx=10, row=12, sticky=tk.W)

    png_entry = nb.Entry(frame, textvariable=this.png_loc)
    png_entry.grid(padx=10, row=12, column=1, sticky=tk.EW)

    nb.Checkbutton(frame,
                   text="Delete Original File",
                   variable=this.delete_org).grid()
    nb.Checkbutton(frame,
                   text="Group files by system directory",
                   variable=this.mkdir).grid()

    return frame
示例#14
0
def plugin_prefs(parent, cmdr, is_beta):
    webHooks = getWebHooks()
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)
    this.webHooksUi = []
    nb.Label(frame, text="discord webhooks")
    for i in xrange(this.webhookLimit):
        tempEntry = nb.Entry(frame)
        row = 8 + (i * 2)
        tempEntry.grid(padx=10, row=row)
        this.webHooksUi.append(tempEntry)
        if i < len(webHooks):
            this.webHooksUi[i].delete(0, tk.END)
            this.webHooksUi[i].insert(0, webHooks[i])

    return frame
示例#15
0
def plugin_prefs(parent, cmdr, is_beta):
    """
   Return a TK Frame for adding to the EDMC settings dialog.
   """
    this.port = tk.IntVar(
        value=config.getint("edmqPORT"))  # Retrieve saved value from config
    frame = nb.Frame(parent)
    nb.Label(frame,
             text="Welcome to EDMQ v" + this.version + " settings").grid()

    port_label = nb.Label(frame, text="API Key :").grid()
    # port_label.grid(row=11, padx=PADX, sticky=tk.W)
    port_entry = nb.Entry(frame, textvariable=this.port).grid()
    # port_entry.grid(row=11, column=1, padx=PADX, pady=PADY, sticky=tk.EW)
    this.server.send_sys(u'plugin_perfs')

    return frame
示例#16
0
def plugin_prefs(parent, cmdr, is_beta):
    frame = nb.Frame(parent)
    settings = get_settings()

    if this.settings == []:
        this.settings = [tk.StringVar(), tk.StringVar()]

    nb.Label(frame,
             text='Value for each body in a discovery scan:').grid(row=0,
                                                                   column=0,
                                                                   padx=10,
                                                                   pady=(10,
                                                                         0))
    this.settings[0].set(settings[0])
    nb.Entry(frame, textvariable=this.settings[0]).grid(row=0,
                                                        column=1,
                                                        sticky=tk.W,
                                                        pady=(10, 0))

    this.settings[1].set(settings[1])
    nb.Checkbutton(frame,
                   text='Display plugin events.',
                   variable=this.settings[1],
                   onvalue='Y',
                   offvalue='N').grid(row=1,
                                      column=0,
                                      columnspan=2,
                                      padx=10,
                                      sticky=tk.W)
    nb.Button(frame, text="Clear Banked Data",
              command=this.bank.clearBank).grid(row=2,
                                                column=0,
                                                padx=10,
                                                sticky=tk.W)
    nb.Label(frame,
             text="WARNING: Clearing your banked data is irreversable.").grid(
                 row=2, column=1, sticky=tk.W)

    nb.Label(frame, text='Version {}'.format(VERSION)).grid(padx=10,
                                                            pady=10,
                                                            sticky=tk.W)

    return frame
示例#17
0
def plugin_prefs(parent: tk.Tk, cmdr: str, is_beta: bool) -> tk.Frame:
    """Plugin Preferences UI hook."""
    PADX = 10
    BUTTONX = 12  # indent Checkbuttons and Radiobuttons
    PADY = 2		# close spacing

    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    HyperlinkLabel(
        frame, text='Inara', background=nb.Label().cget('background'), url='https://inara.cz/', underline=True
    ).grid(columnspan=2, padx=PADX, sticky=tk.W)  # Don't translate

    this.log = tk.IntVar(value=config.getint('inara_out') and 1)
    this.log_button = nb.Checkbutton(
        frame, text=_('Send flight log and Cmdr status to Inara'), variable=this.log, command=prefsvarchanged
    )

    this.log_button.grid(columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)

    nb.Label(frame).grid(sticky=tk.W)  # big spacer

    # Section heading in settings
    this.label = HyperlinkLabel(
        frame,
        text=_('Inara credentials'),
        background=nb.Label().cget('background'),
        url='https://inara.cz/settings-api',
        underline=True
    )

    this.label.grid(columnspan=2, padx=PADX, sticky=tk.W)

    this.apikey_label = nb.Label(frame, text=_('API Key'))  # Inara setting
    this.apikey_label.grid(row=12, padx=PADX, sticky=tk.W)
    this.apikey = nb.Entry(frame)
    this.apikey.grid(row=12, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    prefs_cmdr_changed(cmdr, is_beta)

    return frame
示例#18
0
    def setup_preferences(self, parent: nb.Notebook, cmdr: str,
                          is_beta: bool) -> Optional[tk.Frame]:
        """
        setup_preferences is called by plugin_prefs below.

        It is where we can setup our own settings page in EDMC's settings window. Our tab is defined for us.

        :param parent: the tkinter parent that our returned Frame will want to inherit from
        :param cmdr: The current ED Commander
        :param is_beta: Whether or not EDMC is currently marked as in beta mode
        :return: The frame to add to the settings window
        """
        current_row = 0
        frame = nb.Frame(parent)

        # setup our config in a "Click Count: number"
        nb.Label(frame, text='Click Count').grid(row=current_row)
        nb.Entry(frame, textvariable=self.click_count).grid(row=current_row,
                                                            column=1)
        current_row += 1  # Always increment our row counter, makes for far easier tkinter design.
        return frame
示例#19
0
def plugin_prefs(parent):
    """
    Handle plugin tab
    :param parent:
    :return:
    """
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    nb.Label(frame, text="Scanner Options", fg="blue")\
        .grid(padx=_padx, row=0, sticky=tk.W)

    nb.Label(frame, text="Disable Elite time") \
        .grid(padx=_padx, pady=_pady, row=1, sticky=tk.W)
    nb.Checkbutton(frame, text="Use normal UTC time instead of Elite 330x time.",
                   variable=oc.DISABLE_ED_TIME_FIELD) \
        .grid(padx=_padx, pady=_pady, row=1, column=1, sticky=tk.W)

    nb.Label(frame, text="Overlay Options (You have to install EDMCOverlay)", fg="blue")\
        .grid(padx=_padx, row=5, sticky=tk.W)

    nb.Label(frame, text="Use Overlay") \
        .grid(padx=_padx, pady=_pady, row=6, sticky=tk.W)
    nb.Checkbutton(frame, text="Use EDMCOverlay (you need to restart EDMC).",
                   variable=oc.ENABLE_OVERLAY_FIELD) \
        .grid(padx=_padx, pady=_pady, row=6, column=1, sticky=tk.W)

    nb.Label(frame, text="Overlay duration (in seconds)") \
        .grid(padx=_padx, pady=_pady, row=7, sticky=tk.W)
    nb.Entry(frame, textvariable=oc.TTL_FIELD) \
        .grid(padx=_padx, pady=_pady, row=7, column=1, sticky=tk.EW)

    nb.Label(frame, text="Disable service messages") \
        .grid(padx=_padx, pady=_pady, row=8, sticky=tk.W)
    nb.Checkbutton(frame, text="Disable activation/deactivation messages (Overlay only).",
                   variable=oc.DISABLE_SERVICE_MSG_FIELD) \
        .grid(padx=_padx, pady=_pady, row=8, column=1, sticky=tk.W)

    return frame
示例#20
0
def plugin_prefs(parent, cmdr, is_beta):
    this.frame = nb.Frame(parent)
    this.frame.bind_all("<<DistanceCalc-EDSM-Response>>", updatePrefsUI)
    frameTop = nb.Frame(this.frame)
    frameTop.grid(row=0, column=0, sticky=tk.W)
    frameBottom = nb.Frame(this.frame)
    frameBottom.grid(row=1, column=0, sticky=tk.SW)

    # headline
    nb.Label(frameTop, text="Systems").grid(row=0, column=0, sticky=tk.EW)
    nb.Label(frameTop, text="X").grid(row=0, column=1, sticky=tk.EW)
    nb.Label(frameTop, text="Y").grid(row=0, column=2, sticky=tk.EW)
    nb.Label(frameTop, text="Z").grid(row=0, column=3, sticky=tk.EW)

    this.errorLabel = nb.Label(frameTop, text="")

    this.settingsUiElements = list()
    vcmd = (frameTop.register(validate), '%d', '%i', '%P', '%s', '%S', '%v',
            '%V', '%W')

    # create and add fields to enter systems
    for i in range(3):
        systemEntry = nb.Entry(frameTop)
        systemEntry.grid(row=i + 1,
                         column=0,
                         padx=(this.PADX * 2, this.PADX),
                         sticky=tk.W)
        systemEntry.config(
            width=this.WIDTH * 4
        )  # set fixed width. columnconfigure doesn't work because it already fits

        xEntry = nb.Entry(frameTop, validate='key', validatecommand=vcmd)
        xEntry.grid(row=i + 1, column=1, padx=this.PADX, sticky=tk.W)
        xEntry.config(
            width=this.WIDTH
        )  # set fixed width. columnconfigure doesn't work because it already fits

        yEntry = nb.Entry(frameTop, validate='key', validatecommand=vcmd)
        yEntry.grid(row=i + 1, column=2, padx=this.PADX, sticky=tk.W)
        yEntry.config(
            width=this.WIDTH
        )  # set fixed width. columnconfigure doesn't work because it already fits

        zEntry = nb.Entry(frameTop, validate='key', validatecommand=vcmd)
        zEntry.grid(row=i + 1, column=3, padx=this.PADX, sticky=tk.W)
        zEntry.config(
            width=this.WIDTH
        )  # set fixed width. columnconfigure doesn't work because it already fits

        clearButton = nb.Button(frameTop,
                                text="Clear",
                                command=partial(clearInputFields, systemEntry,
                                                xEntry, yEntry, zEntry))
        clearButton.grid(row=i + 1, column=4, padx=this.PADX, sticky=tk.W)
        clearButton.config(width=7)

        edsmButton = nb.Button(frameTop, text="EDSM")
        edsmButton.grid(row=i + 1,
                        column=5,
                        padx=(this.PADX, this.PADX * 2),
                        sticky=tk.W)
        edsmButton.config(width=7,
                          command=partial(fillSystemInformationFromEdsmAsync,
                                          i, systemEntry))

        this.settingsUiElements.append(
            SettingsUiElements(systemEntry, xEntry, yEntry, zEntry,
                               edsmButton))

    # EDSM result label and information about what coordinates can be entered
    this.errorLabel.grid(row=4,
                         column=0,
                         columnspan=6,
                         padx=this.PADX * 2,
                         sticky=tk.W)
    nb.Label(
        frameTop,
        text=
        "You can get coordinates from EDDB or EDSM or enter any valid coordinate."
    ).grid(row=5, column=0, columnspan=6, padx=this.PADX * 2, sticky=tk.W)
    ttk.Separator(frameTop, orient=tk.HORIZONTAL).grid(row=6,
                                                       columnspan=6,
                                                       padx=this.PADX * 2,
                                                       pady=8,
                                                       sticky=tk.EW)

    # total travelled distance
    travelledTotal = nb.Checkbutton(frameBottom,
                                    variable=this.travelledTotalOption,
                                    text="Calculate total travelled distance")
    travelledTotal.var = this.travelledTotalOption
    travelledTotal.grid(row=0, column=0, padx=this.PADX * 2, sticky=tk.W)
    resetButton = nb.Button(frameBottom,
                            text="Reset",
                            command=resetTotalTravelledDistance)
    resetButton.grid(row=1, column=0, padx=this.PADX * 4, pady=5, sticky=tk.W)

    travelledSession = nb.Checkbutton(
        frameBottom,
        variable=this.travelledSessionOption,
        text="Calculate travelled distance for current session")
    travelledSession.var = this.travelledSessionOption
    travelledSession.grid(row=2, column=0, padx=this.PADX * 2, sticky=tk.W)

    # radio button value: 1 = calculate for ED session; 0 = calculate for EDMC session
    travelledSessionEdmc = nb.Radiobutton(
        frameBottom,
        variable=this.travelledSessionSelected,
        value=0,
        text="EDMC session")
    travelledSessionEdmc.var = this.travelledSessionSelected
    travelledSessionEdmc.grid(row=3, column=0, padx=this.PADX * 4, sticky=tk.W)

    travelledSessionElite = nb.Radiobutton(
        frameBottom,
        variable=this.travelledSessionSelected,
        value=1,
        text="Elite session")
    travelledSessionElite.var = this.travelledSessionSelected
    travelledSessionElite.grid(row=4,
                               column=0,
                               padx=this.PADX * 4,
                               sticky=tk.W)

    setStateRadioButtons(travelledSessionEdmc, travelledSessionElite)
    travelledSession.config(command=partial(
        setStateRadioButtons, travelledSessionEdmc, travelledSessionElite))

    nb.Label(frameBottom).grid(row=5)  # spacer
    nb.Label(frameBottom).grid(row=6)  # spacer
    nb.Label(frameBottom, text="Plugin version: {0}".format(
        this.VERSION)).grid(row=7, column=0, padx=this.PADX, sticky=tk.W)
    HyperlinkLabel(this.frame,
                   text="Open the Github page for this plugin",
                   background=nb.Label().cget("background"),
                   url="https://github.com/Thurion/DistanceCalc/",
                   underline=True).grid(row=8,
                                        column=0,
                                        padx=this.PADX,
                                        sticky=tk.W)
    HyperlinkLabel(this.frame, text="Get estimated coordinates from EDTS", background=nb.Label().cget("background"), url="http://edts.thargoid.space/", underline=True)\
        .grid(row=9, column=0, padx=this.PADX, sticky=tk.W)

    def fillEntries(s, x, y, z, systemEntry, xEntry, yEntry, zEntry):
        systemEntry.insert(0, s)
        xEntry.insert(0, Locale.stringFromNumber(x))
        yEntry.insert(0, Locale.stringFromNumber(y))
        zEntry.insert(0, Locale.stringFromNumber(z))

    row = 0
    if len(this.distances) > 0:
        for var in this.distances:
            settingsUiElement = this.settingsUiElements[row]
            fillEntries(var["system"], var["x"], var["y"], var["z"],
                        settingsUiElement.systemEntry,
                        settingsUiElement.xEntry, settingsUiElement.yEntry,
                        settingsUiElement.zEntry)
            row += 1

    return this.frame
示例#21
0
    def __init__(self, parent, callback):
        tk.Toplevel.__init__(self, parent)

        self.parent = parent
        self.callback = callback
        self.title(platform == 'darwin' and _('Preferences') or _('Settings'))

        if parent.winfo_viewable():
            self.transient(parent)

        # position over parent
        if platform != 'darwin' or parent.winfo_rooty(
        ) > 0:  # http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7
            self.geometry("+%d+%d" %
                          (parent.winfo_rootx(), parent.winfo_rooty()))

        # remove decoration
        if platform == 'win32':
            self.attributes('-toolwindow', tk.TRUE)
        elif platform == 'darwin':
            # http://wiki.tcl.tk/13428
            parent.call('tk::unsupported::MacWindowStyle', 'style', self,
                        'utility')
        self.resizable(tk.FALSE, tk.FALSE)

        self.cmdr = False  # Note if Cmdr changes in the Journal
        self.is_beta = False  # Note if Beta status changes in the Journal
        self.cmdrchanged_alarm = None

        frame = ttk.Frame(self)
        frame.grid(sticky=tk.NSEW)

        notebook = nb.Notebook(frame)
        notebook.bind('<<NotebookTabChanged>>',
                      self.outvarchanged)  # Recompute on tab change

        PADX = 10
        BUTTONX = 12  # indent Checkbuttons and Radiobuttons
        PADY = 2  # close spacing

        credframe = nb.Frame(notebook)
        credframe.columnconfigure(1, weight=1)

        nb.Label(credframe, text=_('Credentials')).grid(
            padx=PADX, sticky=tk.W)  # Section heading in settings
        ttk.Separator(credframe, orient=tk.HORIZONTAL).grid(columnspan=2,
                                                            padx=PADX,
                                                            pady=PADY,
                                                            sticky=tk.EW)
        self.cred_label = nb.Label(credframe)
        self.cred_label.grid(padx=PADX, columnspan=2, sticky=tk.W)
        self.cmdr_label = nb.Label(credframe, text=_('Cmdr'))  # Main window
        self.cmdr_label.grid(row=10, padx=PADX, sticky=tk.W)
        self.username_label = nb.Label(
            credframe, text=_('Username (Email)')
        )  # Use same text as E:D Launcher's login dialog
        self.username_label.grid(row=11, padx=PADX, sticky=tk.W)
        self.password_label = nb.Label(
            credframe,
            text=_('Password'))  # Use same text as E:D Launcher's login dialog
        self.password_label.grid(row=12, padx=PADX, sticky=tk.W)

        self.cmdr_text = nb.Label(credframe)
        self.cmdr_text.grid(row=10,
                            column=1,
                            padx=PADX,
                            pady=PADY,
                            sticky=tk.W)
        self.username = nb.Entry(credframe)
        self.username.grid(row=11,
                           column=1,
                           padx=PADX,
                           pady=PADY,
                           sticky=tk.EW)
        if monitor.cmdr:
            self.username.focus_set()
        self.password = nb.Entry(credframe, show=u'•')
        self.password.grid(row=12,
                           column=1,
                           padx=PADX,
                           pady=PADY,
                           sticky=tk.EW)

        nb.Label(credframe).grid(sticky=tk.W)  # big spacer
        nb.Label(credframe, text=_('Privacy')).grid(
            padx=PADX, sticky=tk.W)  # Section heading in settings
        ttk.Separator(credframe, orient=tk.HORIZONTAL).grid(columnspan=2,
                                                            padx=PADX,
                                                            pady=PADY,
                                                            sticky=tk.EW)

        self.out_anon = tk.IntVar(value=config.getint('anonymous') and 1)
        nb.Label(
            credframe,
            text=_('How do you want to be identified in the saved data')).grid(
                columnspan=2, padx=PADX, sticky=tk.W)
        nb.Radiobutton(credframe,
                       text=_('Cmdr name'),
                       variable=self.out_anon,
                       value=0).grid(columnspan=2, padx=BUTTONX,
                                     sticky=tk.W)  # Privacy setting
        nb.Radiobutton(credframe,
                       text=_('Pseudo-anonymized ID'),
                       variable=self.out_anon,
                       value=1).grid(columnspan=2, padx=BUTTONX,
                                     sticky=tk.W)  # Privacy setting

        notebook.add(credframe, text=_('Identity'))  # Tab heading in settings

        outframe = nb.Frame(notebook)
        outframe.columnconfigure(0, weight=1)

        output = config.getint('output') or (
            config.OUT_MKT_EDDN | config.OUT_SYS_EDDN | config.OUT_SHIP
        )  # default settings

        self.out_label = nb.Label(outframe,
                                  text=_('Please choose what data to save'))
        self.out_label.grid(columnspan=2, padx=PADX, sticky=tk.W)
        self.out_csv = tk.IntVar(value=(output & config.OUT_MKT_CSV) and 1)
        self.out_csv_button = nb.Checkbutton(
            outframe,
            text=_('Market data in CSV format file'),
            variable=self.out_csv,
            command=self.outvarchanged)
        self.out_csv_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_td = tk.IntVar(value=(output & config.OUT_MKT_TD) and 1)
        self.out_td_button = nb.Checkbutton(
            outframe,
            text=_('Market data in Trade Dangerous format file'),
            variable=self.out_td,
            command=self.outvarchanged)
        self.out_td_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_ship = tk.IntVar(
            value=(output & (config.OUT_SHIP | config.OUT_SHIP_EDS
                             | config.OUT_SHIP_CORIOLIS) and 1))
        self.out_ship_button = nb.Checkbutton(
            outframe,
            text=_('Ship loadout'),
            variable=self.out_ship,
            command=self.outvarchanged)  # Output setting
        self.out_ship_button.grid(columnspan=2,
                                  padx=BUTTONX,
                                  pady=(5, 0),
                                  sticky=tk.W)
        self.out_auto = tk.IntVar(value=0 if output
                                  & config.OUT_MKT_MANUAL else 1)  # inverted
        self.out_auto_button = nb.Checkbutton(
            outframe,
            text=_('Automatically update on docking'),
            variable=self.out_auto,
            command=self.outvarchanged)  # Output setting
        self.out_auto_button.grid(columnspan=2,
                                  padx=BUTTONX,
                                  pady=(5, 0),
                                  sticky=tk.W)

        self.outdir = tk.StringVar()
        self.outdir.set(config.get('outdir'))
        self.outdir_label = nb.Label(outframe, text=_('File location') +
                                     ':')  # Section heading in settings
        self.outdir_label.grid(padx=PADX, pady=(5, 0), sticky=tk.W)
        self.outdir_entry = nb.Entry(outframe, takefocus=False)
        self.outdir_entry.grid(columnspan=2,
                               padx=PADX,
                               pady=(0, PADY),
                               sticky=tk.EW)
        self.outbutton = nb.Button(
            outframe,
            text=(
                platform == 'darwin' and _('Change...')
                or  # Folder selection button on OSX
                _('Browse...')),  # Folder selection button on Windows
            command=lambda: self.filebrowse(_('File location'), self.outdir))
        self.outbutton.grid(column=1, padx=PADX, pady=PADY, sticky=tk.NSEW)
        nb.Frame(outframe).grid(pady=5)  # bottom spacer

        notebook.add(outframe, text=_('Output'))  # Tab heading in settings

        eddnframe = nb.Frame(notebook)

        HyperlinkLabel(eddnframe,
                       text='Elite Dangerous Data Network',
                       background=nb.Label().cget('background'),
                       url='https://github.com/EDSM-NET/EDDN/wiki',
                       underline=True).grid(padx=PADX,
                                            sticky=tk.W)  # Don't translate
        self.eddn_station = tk.IntVar(
            value=(output & config.OUT_MKT_EDDN) and 1)
        self.eddn_station_button = nb.Checkbutton(
            eddnframe,
            text=_('Send station data to the Elite Dangerous Data Network'),
            variable=self.eddn_station,
            command=self.outvarchanged)  # Output setting
        self.eddn_station_button.grid(padx=BUTTONX, pady=(5, 0), sticky=tk.W)
        self.eddn_auto_button = nb.Checkbutton(
            eddnframe,
            text=_('Automatically update on docking'),
            variable=self.out_auto,
            command=self.outvarchanged)  # Output setting
        self.eddn_auto_button.grid(padx=BUTTONX, sticky=tk.W)
        self.eddn_system = tk.IntVar(
            value=(output & config.OUT_SYS_EDDN) and 1)
        self.eddn_system_button = nb.Checkbutton(
            eddnframe,
            text=_(
                'Send system and scan data to the Elite Dangerous Data Network'
            ),
            variable=self.eddn_system,
            command=self.outvarchanged)  # Output setting new in E:D 2.2
        self.eddn_system_button.grid(padx=BUTTONX, pady=(5, 0), sticky=tk.W)
        self.eddn_delay = tk.IntVar(
            value=(output & config.OUT_SYS_DELAY) and 1)
        self.eddn_delay_button = nb.Checkbutton(
            eddnframe,
            text=_('Delay sending until docked'),
            variable=self.eddn_delay
        )  # Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2
        self.eddn_delay_button.grid(padx=BUTTONX, sticky=tk.W)

        notebook.add(eddnframe, text='EDDN')  # Not translated

        # build plugin prefs tabs
        for plugin in plug.PLUGINS:
            plugframe = plugin.get_prefs(notebook, monitor.cmdr,
                                         monitor.is_beta)
            if plugframe:
                notebook.add(plugframe, text=plugin.name)

        configframe = nb.Frame(notebook)
        configframe.columnconfigure(1, weight=1)

        self.logdir = tk.StringVar()
        self.logdir.set(
            config.get('journaldir') or config.default_journal_dir or '')
        self.logdir_entry = nb.Entry(configframe, takefocus=False)

        if platform != 'darwin':
            # Apple's SMB implementation is way too flaky - no filesystem events and bogus NULLs
            nb.Label(
                configframe, text=_('E:D journal file location') + ':').grid(
                    columnspan=4, padx=PADX,
                    sticky=tk.W)  # Location of the new Journal file in E:D 2.2
            self.logdir_entry.grid(columnspan=4,
                                   padx=PADX,
                                   pady=(0, PADY),
                                   sticky=tk.EW)
            self.logbutton = nb.Button(
                configframe,
                text=(
                    platform == 'darwin' and _('Change...')
                    or  # Folder selection button on OSX
                    _('Browse...')),  # Folder selection button on Windows
                command=lambda: self.filebrowse(_('E:D journal file location'),
                                                self.logdir))
            self.logbutton.grid(row=10,
                                column=3,
                                padx=PADX,
                                pady=PADY,
                                sticky=tk.EW)
            if config.default_journal_dir:
                nb.Button(
                    configframe,
                    text=_('Default'),
                    command=self.logdir_reset,
                    state=config.get('journaldir') and tk.NORMAL
                    or tk.DISABLED).grid(
                        row=10, column=2, pady=PADY,
                        sticky=tk.EW)  # Appearance theme and language setting

        if platform == 'win32':
            ttk.Separator(configframe,
                          orient=tk.HORIZONTAL).grid(columnspan=4,
                                                     padx=PADX,
                                                     pady=PADY * 4,
                                                     sticky=tk.EW)

        if platform in ['darwin', 'win32']:
            self.hotkey_code = config.getint('hotkey_code')
            self.hotkey_mods = config.getint('hotkey_mods')
            self.hotkey_only = tk.IntVar(
                value=not config.getint('hotkey_always'))
            self.hotkey_play = tk.IntVar(
                value=not config.getint('hotkey_mute'))
            nb.Label(
                configframe,
                text=platform == 'darwin' and _('Keyboard shortcut')
                or  # Hotkey/Shortcut settings prompt on OSX
                _('Hotkey')  # Hotkey/Shortcut settings prompt on Windows
            ).grid(row=20, padx=PADX, sticky=tk.W)
            if platform == 'darwin' and not was_accessible_at_launch:
                if AXIsProcessTrusted():
                    nb.Label(
                        configframe,
                        text=_('Re-start {APP} to use shortcuts').format(
                            APP=applongname),
                        foreground='firebrick').grid(
                            padx=PADX,
                            sticky=tk.W)  # Shortcut settings prompt on OSX
                else:
                    nb.Label(
                        configframe,
                        text=_('{APP} needs permission to use shortcuts'
                               ).format(APP=applongname),
                        foreground='firebrick').grid(
                            columnspan=4, padx=PADX,
                            sticky=tk.W)  # Shortcut settings prompt on OSX
                    nb.Button(
                        configframe,
                        text=_('Open System Preferences'),
                        command=self.enableshortcuts).grid(
                            padx=PADX,
                            sticky=tk.E)  # Shortcut settings button on OSX
            else:
                self.hotkey_text = nb.Entry(configframe,
                                            width=(platform == 'darwin' and 20
                                                   or 30),
                                            justify=tk.CENTER)
                self.hotkey_text.insert(
                    0, self.hotkey_code
                    and hotkeymgr.display(self.hotkey_code, self.hotkey_mods)
                    or _('None'))  # No hotkey/shortcut currently defined
                self.hotkey_text.bind('<FocusIn>', self.hotkeystart)
                self.hotkey_text.bind('<FocusOut>', self.hotkeyend)
                self.hotkey_text.grid(row=20,
                                      column=1,
                                      columnspan=2,
                                      padx=PADX,
                                      pady=(5, 0),
                                      sticky=tk.W)
                self.hotkey_only_btn = nb.Checkbutton(
                    configframe,
                    text=_('Only when Elite: Dangerous is the active app'),
                    variable=self.hotkey_only,
                    state=self.hotkey_code and tk.NORMAL
                    or tk.DISABLED)  # Hotkey/Shortcut setting
                self.hotkey_only_btn.grid(columnspan=4,
                                          padx=PADX,
                                          pady=(5, 0),
                                          sticky=tk.W)
                self.hotkey_play_btn = nb.Checkbutton(
                    configframe,
                    text=_('Play sound'),
                    variable=self.hotkey_play,
                    state=self.hotkey_code and tk.NORMAL
                    or tk.DISABLED)  # Hotkey/Shortcut setting
                self.hotkey_play_btn.grid(columnspan=4, padx=PADX, sticky=tk.W)

        ttk.Separator(configframe, orient=tk.HORIZONTAL).grid(columnspan=4,
                                                              padx=PADX,
                                                              pady=PADY * 4,
                                                              sticky=tk.EW)
        nb.Label(configframe, text=_('Preferred Shipyard')).grid(
            columnspan=4, padx=PADX, sticky=tk.W
        )  # Setting to decide which ship outfitting website to link to - either E:D Shipyard or Coriolis.
        self.shipyard = tk.IntVar(value=config.getint('shipyard'))
        nb.Radiobutton(configframe,
                       text='E:D Shipyard',
                       variable=self.shipyard,
                       value=config.SHIPYARD_EDSHIPYARD).grid(columnspan=3,
                                                              padx=BUTTONX,
                                                              pady=(5, 0),
                                                              sticky=tk.W)
        nb.Radiobutton(configframe,
                       text='Coriolis',
                       variable=self.shipyard,
                       value=config.SHIPYARD_CORIOLIS).grid(columnspan=3,
                                                            padx=BUTTONX,
                                                            sticky=tk.W)
        nb.Label(configframe).grid(sticky=tk.W)  # big spacer

        notebook.add(configframe,
                     text=_('Configuration'))  # Tab heading in settings

        self.languages = Translations().available_names()
        self.lang = tk.StringVar(value=self.languages.get(
            config.get('language'),
            _('Default')))  # Appearance theme and language setting
        self.always_ontop = tk.BooleanVar(value=config.getint('always_ontop'))
        self.theme = tk.IntVar(value=config.getint('theme'))
        self.theme_colors = [
            config.get('dark_text'),
            config.get('dark_highlight')
        ]
        self.theme_prompts = [
            _('Normal text'),  # Dark theme color setting
            _('Highlighted text'),  # Dark theme color setting
        ]
        themeframe = nb.Frame(notebook)
        themeframe.columnconfigure(2, weight=1)
        nb.Label(themeframe, text=_('Language')).grid(
            row=10, padx=PADX, sticky=tk.W)  # Appearance setting prompt
        self.lang_button = nb.OptionMenu(themeframe, self.lang,
                                         self.lang.get(),
                                         *self.languages.values())
        self.lang_button.grid(row=10,
                              column=1,
                              columnspan=2,
                              padx=PADX,
                              sticky=tk.W)
        ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                             padx=PADX,
                                                             pady=PADY * 4,
                                                             sticky=tk.EW)
        nb.Label(themeframe,
                 text=_('Theme')).grid(columnspan=3, padx=PADX,
                                       sticky=tk.W)  # Appearance setting
        nb.Radiobutton(
            themeframe,
            text=_('Default'),
            variable=self.theme,
            value=0,
            command=self.themevarchanged).grid(
                columnspan=3, padx=BUTTONX,
                sticky=tk.W)  # Appearance theme and language setting
        nb.Radiobutton(themeframe,
                       text=_('Dark'),
                       variable=self.theme,
                       value=1,
                       command=self.themevarchanged).grid(
                           columnspan=3, padx=BUTTONX,
                           sticky=tk.W)  # Appearance theme setting
        if platform == 'win32':
            nb.Radiobutton(themeframe,
                           text=_('Transparent'),
                           variable=self.theme,
                           value=2,
                           command=self.themevarchanged).grid(
                               columnspan=3, padx=BUTTONX,
                               sticky=tk.W)  # Appearance theme setting
        self.theme_label_0 = nb.Label(themeframe, text=self.theme_prompts[0])
        self.theme_label_0.grid(row=20, padx=PADX, sticky=tk.W)
        self.theme_button_0 = nb.ColoredButton(
            themeframe,
            text=_('Station'),
            background='grey4',
            command=lambda: self.themecolorbrowse(0))  # Main window
        self.theme_button_0.grid(row=20,
                                 column=1,
                                 padx=PADX,
                                 pady=PADY,
                                 sticky=tk.NSEW)
        self.theme_label_1 = nb.Label(themeframe, text=self.theme_prompts[1])
        self.theme_label_1.grid(row=21, padx=PADX, sticky=tk.W)
        self.theme_button_1 = nb.ColoredButton(
            themeframe,
            text='  Hutton Orbital  ',
            background='grey4',
            command=lambda: self.themecolorbrowse(1))  # Do not translate
        self.theme_button_1.grid(row=21,
                                 column=1,
                                 padx=PADX,
                                 pady=PADY,
                                 sticky=tk.NSEW)
        ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                             padx=PADX,
                                                             pady=PADY * 4,
                                                             sticky=tk.EW)
        self.ontop_button = nb.Checkbutton(themeframe,
                                           text=_('Always on top'),
                                           variable=self.always_ontop,
                                           command=self.themevarchanged)
        self.ontop_button.grid(columnspan=3, padx=BUTTONX,
                               sticky=tk.W)  # Appearance setting
        nb.Label(themeframe).grid(sticky=tk.W)  # big spacer

        notebook.add(themeframe,
                     text=_('Appearance'))  # Tab heading in settings

        # Plugin settings and info
        plugsframe = nb.Frame(notebook)
        plugsframe.columnconfigure(0, weight=1)
        plugdir = tk.StringVar()
        plugdir.set(config.plugin_dir)

        nb.Label(plugsframe, text=_('Plugins folder') + ':').grid(
            padx=PADX, sticky=tk.W)  # Section heading in settings
        plugdirentry = nb.Entry(plugsframe, justify=tk.LEFT)
        self.displaypath(plugdir, plugdirentry)
        plugdirentry.grid(row=10, padx=PADX, sticky=tk.EW)

        nb.Button(
            plugsframe,
            text=_('Open'),  # Button that opens a folder in Explorer/Finder
            command=lambda: webbrowser.open('file:///%s' % plugdir.get())
        ).grid(row=10, column=1, padx=(0, PADX), sticky=tk.NSEW)

        nb.Label(
            plugsframe,
            text=
            _("Tip: You can disable a plugin by{CR}adding '{EXT}' to its folder name"
              ).format(EXT='.disabled')).grid(  # Help text in settings
                  columnspan=2,
                  padx=PADX,
                  pady=10,
                  sticky=tk.NSEW)

        enabled_plugins = [x for x in plug.PLUGINS if x.folder and x.module]
        if len(enabled_plugins):
            ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                                 padx=PADX,
                                                                 pady=PADY * 8,
                                                                 sticky=tk.EW)
            nb.Label(plugsframe, text=_('Enabled Plugins') + ':').grid(
                padx=PADX, sticky=tk.W)  # List of plugins in settings
            for plugin in enabled_plugins:
                if plugin.name == plugin.folder:
                    label = nb.Label(plugsframe, text=plugin.name)
                else:
                    label = nb.Label(plugsframe,
                                     text='%s (%s)' %
                                     (plugin.folder, plugin.name))
                label.grid(columnspan=2, padx=PADX * 2, sticky=tk.W)

        disabled_plugins = [
            x for x in plug.PLUGINS if x.folder and not x.module
        ]
        if len(disabled_plugins):
            ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                                 padx=PADX,
                                                                 pady=PADY * 8,
                                                                 sticky=tk.EW)
            nb.Label(plugsframe, text=_('Disabled Plugins') + ':').grid(
                padx=PADX, sticky=tk.W)  # List of plugins in settings
            for plugin in disabled_plugins:
                nb.Label(plugsframe, text=plugin.name).grid(columnspan=2,
                                                            padx=PADX * 2,
                                                            sticky=tk.W)

        notebook.add(plugsframe, text=_('Plugins'))  # Tab heading in settings

        if platform == 'darwin':
            self.protocol("WM_DELETE_WINDOW",
                          self.apply)  # close button applies changes
        else:
            buttonframe = ttk.Frame(frame)
            buttonframe.grid(padx=PADX, pady=PADX, sticky=tk.NSEW)
            buttonframe.columnconfigure(0, weight=1)
            ttk.Label(buttonframe).grid(row=0, column=0)  # spacer
            button = ttk.Button(buttonframe, text=_('OK'), command=self.apply)
            button.grid(row=0, column=1, sticky=tk.E)
            button.bind("<Return>", lambda event: self.apply())
            self.protocol("WM_DELETE_WINDOW", self._destroy)

        # Selectively disable buttons depending on output settings
        self.cmdrchanged()
        self.themevarchanged()

        # disable hotkey for the duration
        hotkeymgr.unregister()

        # wait for window to appear on screen before calling grab_set
        self.parent.wm_attributes(
            '-topmost',
            0)  # needed for dialog to appear ontop of parent on OSX & Linux
        self.wait_visibility()
        self.grab_set()

        # Ensure fully on-screen
        if platform == 'win32':
            position = RECT()
            GetWindowRect(GetParent(self.winfo_id()), position)
            if CalculatePopupWindowPosition(
                    POINT(parent.winfo_rootx(), parent.winfo_rooty()),
                    SIZE(position.right - position.left,
                         position.bottom - position.top), 0x10000, None,
                    position):
                self.geometry("+%d+%d" % (position.left, position.top))
示例#22
0
    def __init__(self, parent, callback):
        tk.Toplevel.__init__(self, parent)

        self.parent = parent
        self.callback = callback
        self.title(platform=='darwin' and _('Preferences') or
                   _('Settings'))

        if parent.winfo_viewable():
            self.transient(parent)

        # position over parent
        if platform!='darwin' or parent.winfo_rooty()>0:	# http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7
            self.geometry("+%d+%d" % (parent.winfo_rootx(), parent.winfo_rooty()))

        # remove decoration
        self.resizable(tk.FALSE, tk.FALSE)
        if platform=='win32':
            self.attributes('-toolwindow', tk.TRUE)
        elif platform=='darwin':
            # http://wiki.tcl.tk/13428
            parent.call('tk::unsupported::MacWindowStyle', 'style', self, 'utility')

        style = ttk.Style()

        frame = ttk.Frame(self)
        frame.grid(sticky=tk.NSEW)

        notebook = nb.Notebook(frame)

        PADX = 10
        BUTTONX = 12	# indent Checkbuttons and Radiobuttons
        PADY = 2	# close spacing

        credframe = nb.Frame(notebook)
        credframe.columnconfigure(1, weight=1)

        nb.Label(credframe, text=_('Credentials')).grid(padx=PADX, sticky=tk.W)	# Section heading in settings
        ttk.Separator(credframe, orient=tk.HORIZONTAL).grid(columnspan=2, padx=PADX, pady=PADY, sticky=tk.EW)
        nb.Label(credframe, text=_('Please log in with your Elite: Dangerous account details')).grid(padx=PADX, columnspan=2, sticky=tk.W)	# Use same text as E:D Launcher's login dialog
        nb.Label(credframe, text=_('Username (Email)')).grid(row=10, padx=PADX, sticky=tk.W)	# Use same text as E:D Launcher's login dialog
        nb.Label(credframe, text=_('Password')).grid(row=11, padx=PADX, sticky=tk.W)		# Use same text as E:D Launcher's login dialog

        self.username = nb.Entry(credframe)
        self.username.insert(0, config.get('username') or '')
        self.username.grid(row=10, column=1, padx=PADX, pady=PADY, sticky=tk.EW)
        self.username.focus_set()
        self.password = nb.Entry(credframe, show=u'•')
        self.password.insert(0, config.get('password') or '')
        self.password.grid(row=11, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

        nb.Label(credframe).grid(sticky=tk.W)	# big spacer
        nb.Label(credframe, text=_('Privacy')).grid(padx=PADX, sticky=tk.W)	# Section heading in settings
        ttk.Separator(credframe, orient=tk.HORIZONTAL).grid(columnspan=2, padx=PADX, pady=PADY, sticky=tk.EW)

        self.out_anon= tk.IntVar(value = config.getint('anonymous') and 1)
        nb.Label(credframe, text=_('How do you want to be identified in the saved data')).grid(columnspan=2, padx=PADX, sticky=tk.W)
        nb.Radiobutton(credframe, text=_('Cmdr name'), variable=self.out_anon, value=0).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)	# EDSM & privacy setting
        nb.Radiobutton(credframe, text=_('Pseudo-anonymized ID'), variable=self.out_anon, value=1).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)	# Privacy setting

        notebook.add(credframe, text=_('Identity'))		# Tab heading in settings


        outframe = nb.Frame(notebook)
        outframe.columnconfigure(0, weight=1)

        output = config.getint('output') or (config.OUT_EDDN | config.OUT_SHIP_EDS)	# default settings
        nb.Label(outframe, text=_('Please choose what data to save')).grid(columnspan=2, padx=PADX, sticky=tk.W)
        self.out_eddn= tk.IntVar(value = (output & config.OUT_EDDN) and 1)
        nb.Checkbutton(outframe, text=_('Send station data to the Elite Dangerous Data Network'), variable=self.out_eddn, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_csv = tk.IntVar(value = (output & config.OUT_CSV ) and 1)
        nb.Checkbutton(outframe, text=_('Market data in CSV format file'), variable=self.out_csv, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_bpc = tk.IntVar(value = (output & config.OUT_BPC ) and 1)
        nb.Checkbutton(outframe, text=_("Market data in Slopey's BPC format file"), variable=self.out_bpc, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_td  = tk.IntVar(value = (output & config.OUT_TD  ) and 1)
        nb.Checkbutton(outframe, text=_('Market data in Trade Dangerous format file'), variable=self.out_td, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_ship_eds= tk.IntVar(value = (output & config.OUT_SHIP_EDS) and 1)
        nb.Checkbutton(outframe, text=_('Ship loadout in E:D Shipyard format file'), variable=self.out_ship_eds, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, pady=(5,0), sticky=tk.W)
        self.out_ship_coriolis= tk.IntVar(value = (output & config.OUT_SHIP_CORIOLIS) and 1)
        nb.Checkbutton(outframe, text=_('Ship loadout in Coriolis format file'), variable=self.out_ship_coriolis, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_log_file = tk.IntVar(value = (output & config.OUT_LOG_FILE) and 1)
        nb.Checkbutton(outframe, text=_('Flight log in CSV format file'), variable=self.out_log_file, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, pady=(5,0), sticky=tk.W)
        self.out_log_auto = tk.IntVar(value = output & config.OUT_LOG_AUTO and 1 or 0)
        self.out_log_auto_button = nb.Checkbutton(outframe, text=_('Automatically make a log entry on entering a system'), variable=self.out_log_auto, command=self.outvarchanged)	# Output setting
        self.out_log_auto_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_log_auto_text = nb.Label(outframe, foreground='firebrick')
        self.out_log_auto_text.grid(columnspan=2, padx=(30,0), sticky=tk.W)

        self.outdir_label = nb.Label(outframe, text=_('File location'))	# Section heading in settings
        self.outdir_label.grid(padx=BUTTONX, sticky=tk.W)
        self.outdir = nb.Entry(outframe, takefocus=False)
        if config.get('outdir').startswith(config.home):
            self.outdir.insert(0, '~' + config.get('outdir')[len(config.home):])
        else:
            self.outdir.insert(0, config.get('outdir'))
        self.outdir.grid(row=20, padx=(PADX,0), sticky=tk.EW)
        self.outbutton = nb.Button(outframe, text=(platform=='darwin' and _('Change...') or	# Folder selection button on OSX
                                                    _('Browse...')), command=self.outbrowse)	# Folder selection button on Windows
        self.outbutton.grid(row=20, column=1, padx=PADX)
        nb.Frame(outframe).grid(pady=5)	# bottom spacer

        notebook.add(outframe, text=_('Output'))		# Tab heading in settings


        edsmframe = nb.Frame(notebook)
        edsmframe.columnconfigure(1, weight=1)

        HyperlinkLabel(edsmframe, text='Elite Dangerous Star Map', background=nb.Label().cget('background'), url='http://www.edsm.net/', underline=True).grid(columnspan=2, padx=PADX, sticky=tk.W)	# Don't translate
        ttk.Separator(edsmframe, orient=tk.HORIZONTAL).grid(columnspan=2, padx=PADX, pady=PADY, sticky=tk.EW)
        self.out_log_edsm = tk.IntVar(value = (output & config.OUT_LOG_EDSM) and 1)
        nb.Checkbutton(edsmframe, text=_('Send flight log to Elite Dangerous Star Map'), variable=self.out_log_edsm, command=self.outvarchanged).grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.edsm_autoopen = tk.BooleanVar(value = config.getint('edsm_autoopen'))
        self.edsm_autoopen_button = nb.Checkbutton(edsmframe, text=_(u"Automatically open uncharted systems’ EDSM pages"), variable=self.edsm_autoopen)
        self.edsm_autoopen_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.edsm_log_auto_button = nb.Checkbutton(edsmframe, text=_('Automatically make a log entry on entering a system'), variable=self.out_log_auto, command=self.outvarchanged)	# Output setting
        self.edsm_log_auto_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.edsm_log_auto_text = nb.Label(edsmframe, foreground='firebrick')
        self.edsm_log_auto_text.grid(columnspan=2, padx=(30,0), sticky=tk.W)

        self.edsm_label = HyperlinkLabel(edsmframe, text=_('Elite Dangerous Star Map credentials'), background=nb.Label().cget('background'), url='http://www.edsm.net/settings/api', underline=True)	# Section heading in settings
        self.edsm_label.grid(columnspan=2, padx=PADX, sticky=tk.W)

        self.edsm_cmdr_label = nb.Label(edsmframe, text=_('Cmdr name'))	# EDSM & privacy setting
        self.edsm_cmdr_label.grid(row=10, padx=PADX, sticky=tk.W)
        self.edsm_cmdr = nb.Entry(edsmframe)
        self.edsm_cmdr.insert(0, config.get('edsm_cmdrname') or '')
        self.edsm_cmdr.grid(row=10, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

        self.edsm_apikey_label = nb.Label(edsmframe, text=_('API Key'))	# EDSM setting
        self.edsm_apikey_label.grid(row=11, padx=PADX, sticky=tk.W)
        self.edsm_apikey = nb.Entry(edsmframe)
        self.edsm_apikey.insert(0, config.get('edsm_apikey') or '')
        self.edsm_apikey.grid(row=11, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

        notebook.add(edsmframe, text='EDSM')		# Not translated


        if platform in ['darwin','win32']:
            self.hotkey_code = config.getint('hotkey_code')
            self.hotkey_mods = config.getint('hotkey_mods')
            self.hotkey_only = tk.IntVar(value = not config.getint('hotkey_always'))
            self.hotkey_play = tk.IntVar(value = not config.getint('hotkey_mute'))
            hotkeyframe = nb.Frame(notebook)
            hotkeyframe.columnconfigure(1, weight=1)
            nb.Label(hotkeyframe).grid(sticky=tk.W)	# big spacer
            if platform == 'darwin' and not was_accessible_at_launch:
                if AXIsProcessTrusted():
                    nb.Label(hotkeyframe, text = _('Re-start {APP} to use shortcuts').format(APP=applongname), foreground='firebrick').grid(padx=PADX, sticky=tk.NSEW)	# Shortcut settings prompt on OSX
                else:
                    nb.Label(hotkeyframe, text = _('{APP} needs permission to use shortcuts').format(APP=applongname), foreground='firebrick').grid(columnspan=2, padx=PADX, sticky=tk.W)		# Shortcut settings prompt on OSX
                    nb.Button(hotkeyframe, text = _('Open System Preferences'), command = self.enableshortcuts).grid(column=1, padx=PADX, sticky=tk.E)		# Shortcut settings button on OSX
            else:
                self.hotkey_text = nb.Entry(hotkeyframe, width = (platform == 'darwin' and 20 or 30), justify=tk.CENTER)
                self.hotkey_text.insert(0, self.hotkey_code and hotkeymgr.display(self.hotkey_code, self.hotkey_mods) or _('None'))	# No hotkey/shortcut currently defined
                self.hotkey_text.bind('<FocusIn>', self.hotkeystart)
                self.hotkey_text.bind('<FocusOut>', self.hotkeyend)
                nb.Label(hotkeyframe, text = platform=='darwin' and
                         _('Keyboard shortcut') or	# Tab heading in settings on OSX
                         _('Hotkey')			# Tab heading in settings on Windows
                         ).grid(row=10, column=0, padx=PADX, sticky=tk.NSEW)
                self.hotkey_text.grid(row=10, column=1, padx=PADX, sticky=tk.NSEW)
                nb.Label(hotkeyframe).grid(sticky=tk.W)	# big spacer
                self.hotkey_only_btn = nb.Checkbutton(hotkeyframe, text=_('Only when Elite: Dangerous is the active app'), variable=self.hotkey_only, state = self.hotkey_code and tk.NORMAL or tk.DISABLED)	# Hotkey/Shortcut setting
                self.hotkey_only_btn.grid(columnspan=2, padx=PADX, sticky=tk.W)
                self.hotkey_play_btn = nb.Checkbutton(hotkeyframe, text=_('Play sound'), variable=self.hotkey_play, state = self.hotkey_code and tk.NORMAL or tk.DISABLED)	# Hotkey/Shortcut setting
                self.hotkey_play_btn.grid(columnspan=2, padx=PADX, sticky=tk.W)

            notebook.add(hotkeyframe, text = platform=='darwin' and
                         _('Keyboard shortcut') or	# Tab heading in settings on OSX
                         _('Hotkey'))			# Tab heading in settings on Windows

        # build plugin prefs tabs
        for plugname in plug.PLUGINS:
            plugframe = plug.get_plugin_pref(plugname, notebook)
            if plugframe:
                notebook.add(plugframe, text=plugname)

        if platform=='darwin':
            self.protocol("WM_DELETE_WINDOW", self.apply)	# close button applies changes
        else:
            buttonframe = ttk.Frame(frame)
            buttonframe.grid(padx=PADX, pady=PADX, sticky=tk.NSEW)
            buttonframe.columnconfigure(0, weight=1)
            ttk.Label(buttonframe).grid(row=0, column=0)	# spacer
            button = ttk.Button(buttonframe, text=_('OK'), command=self.apply)
            button.grid(row=0, column=1, sticky=tk.E)
            button.bind("<Return>", lambda event:self.apply())
            self.protocol("WM_DELETE_WINDOW", self._destroy)

        # Selectively disable buttons depending on output settings
        self.proxypoll()

        # disable hotkey for the duration
        hotkeymgr.unregister()

        # wait for window to appear on screen before calling grab_set
        self.wait_visibility()
        self.grab_set()
示例#23
0
    def __init__(self, parent, callback):
        tk.Toplevel.__init__(self, parent)

        self.parent = parent
        self.callback = callback
        self.title(platform == 'darwin' and _('Preferences') or _('Settings'))

        if parent.winfo_viewable():
            self.transient(parent)

        # position over parent
        if platform != 'darwin' or parent.winfo_rooty(
        ) > 0:  # http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7
            self.geometry("+%d+%d" %
                          (parent.winfo_rootx(), parent.winfo_rooty()))

        # remove decoration
        if platform == 'win32':
            self.attributes('-toolwindow', tk.TRUE)
        elif platform == 'darwin':
            # http://wiki.tcl.tk/13428
            parent.call('tk::unsupported::MacWindowStyle', 'style', self,
                        'utility')
        self.resizable(tk.FALSE, tk.FALSE)

        self.cmdr = False  # Note if Cmdr changes in the Journal
        self.is_beta = False  # Note if Beta status changes in the Journal
        self.cmdrchanged_alarm = None

        frame = ttk.Frame(self)
        frame.grid(sticky=tk.NSEW)

        notebook = nb.Notebook(frame)
        notebook.bind('<<NotebookTabChanged>>',
                      self.tabchanged)  # Recompute on tab change

        PADX = 10
        BUTTONX = 12  # indent Checkbuttons and Radiobuttons
        PADY = 2  # close spacing

        outframe = nb.Frame(notebook)
        outframe.columnconfigure(0, weight=1)

        output = config.getint('output')  # default settings

        self.out_label = nb.Label(outframe,
                                  text=_('Please choose what data to save'))
        self.out_label.grid(columnspan=2, padx=PADX, sticky=tk.W)
        #        self.out_csv = tk.IntVar(value = (output & config.OUT_MKT_CSV ) and 1)
        #        self.out_csv_button = nb.Checkbutton(outframe, text=_('Market data in CSV format file'), variable=self.out_csv, command=self.outvarchanged)
        #        self.out_csv_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        #        self.out_td  = tk.IntVar(value = (output & config.OUT_MKT_TD  ) and 1)
        #        self.out_td_button = nb.Checkbutton(outframe, text=_('Market data in Trade Dangerous format file'), variable=self.out_td, command=self.outvarchanged)
        #        self.out_td_button.grid(columnspan=2, padx=BUTTONX, sticky=tk.W)
        self.out_ship = tk.IntVar(value=(output & config.OUT_SHIP) and 1)
        self.out_ship_button = nb.Checkbutton(
            outframe,
            text=_('Ship loadout'),
            variable=self.out_ship,
            command=self.outvarchanged)  # Output setting
        self.out_ship_button.grid(columnspan=2,
                                  padx=BUTTONX,
                                  pady=(5, 0),
                                  sticky=tk.W)

        self.outdir = tk.StringVar()
        self.outdir.set(config.get('outdir'))
        self.outdir_label = nb.Label(outframe, text=_('File location') +
                                     ':')  # Section heading in settings
        self.outdir_label.grid(padx=PADX, pady=(5, 0), sticky=tk.W)
        self.outdir_entry = nb.Entry(outframe, takefocus=False)
        self.outdir_entry.grid(columnspan=2,
                               padx=PADX,
                               pady=(0, PADY),
                               sticky=tk.EW)
        self.outbutton = nb.Button(
            outframe,
            text=(
                platform == 'darwin' and _('Change...')
                or  # Folder selection button on OSX
                _('Browse...')),  # Folder selection button on Windows
            command=lambda: self.filebrowse(_('File location'), self.outdir))
        self.outbutton.grid(column=1, padx=PADX, pady=PADY, sticky=tk.NSEW)
        nb.Frame(outframe).grid(pady=5)  # bottom spacer

        notebook.add(outframe, text=_('Output'))  # Tab heading in settings

        # build theme settings

        self.languages = Translations.available_names()
        self.lang = tk.StringVar(value=self.languages.get(
            config.get('language'),
            _('Default')))  # Appearance theme and language setting
        self.always_ontop = tk.BooleanVar(value=config.getint('always_ontop'))
        self.theme = tk.IntVar(value=config.getint('theme'))
        self.theme_colors = [
            config.get('dark_text'),
            config.get('dark_highlight')
        ]
        self.theme_prompts = [
            _('Normal text'),  # Dark theme color setting
            _('Highlighted text'),  # Dark theme color setting
        ]

        themeframe = nb.Frame(notebook)
        themeframe.columnconfigure(2, weight=1)
        nb.Label(themeframe, text=_('Language')).grid(
            row=10, padx=PADX, sticky=tk.W)  # Appearance setting prompt
        self.lang_button = nb.OptionMenu(themeframe, self.lang,
                                         self.lang.get(),
                                         *self.languages.values())
        self.lang_button.grid(row=10,
                              column=1,
                              columnspan=2,
                              padx=PADX,
                              sticky=tk.W)
        ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                             padx=PADX,
                                                             pady=PADY * 4,
                                                             sticky=tk.EW)
        nb.Label(themeframe,
                 text=_('Theme')).grid(columnspan=3, padx=PADX,
                                       sticky=tk.W)  # Appearance setting
        nb.Radiobutton(
            themeframe,
            text=_('Default'),
            variable=self.theme,
            value=0,
            command=self.themevarchanged).grid(
                columnspan=3, padx=BUTTONX,
                sticky=tk.W)  # Appearance theme and language setting
        nb.Radiobutton(themeframe,
                       text=_('Dark'),
                       variable=self.theme,
                       value=1,
                       command=self.themevarchanged).grid(
                           columnspan=3, padx=BUTTONX,
                           sticky=tk.W)  # Appearance theme setting
        if platform == 'win32':
            nb.Radiobutton(themeframe,
                           text=_('Transparent'),
                           variable=self.theme,
                           value=2,
                           command=self.themevarchanged).grid(
                               columnspan=3, padx=BUTTONX,
                               sticky=tk.W)  # Appearance theme setting
        self.theme_label_0 = nb.Label(themeframe, text=self.theme_prompts[0])
        self.theme_label_0.grid(row=20, padx=PADX, sticky=tk.W)
        self.theme_button_0 = nb.ColoredButton(
            themeframe,
            text=_('Station'),
            background='grey4',
            command=lambda: self.themecolorbrowse(0))  # Main window
        self.theme_button_0.grid(row=20,
                                 column=1,
                                 padx=PADX,
                                 pady=PADY,
                                 sticky=tk.NSEW)
        self.theme_label_1 = nb.Label(themeframe, text=self.theme_prompts[1])
        self.theme_label_1.grid(row=21, padx=PADX, sticky=tk.W)
        self.theme_button_1 = nb.ColoredButton(
            themeframe,
            text='  Hutton Orbital  ',
            background='grey4',
            command=lambda: self.themecolorbrowse(1))  # Do not translate
        self.theme_button_1.grid(row=21,
                                 column=1,
                                 padx=PADX,
                                 pady=PADY,
                                 sticky=tk.NSEW)
        ttk.Separator(themeframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                             padx=PADX,
                                                             pady=PADY * 4,
                                                             sticky=tk.EW)
        self.ontop_button = nb.Checkbutton(themeframe,
                                           text=_('Always on top'),
                                           variable=self.always_ontop,
                                           command=self.themevarchanged)
        self.ontop_button.grid(columnspan=3, padx=BUTTONX,
                               sticky=tk.W)  # Appearance setting
        nb.Label(themeframe).grid(sticky=tk.W)  # big spacer

        notebook.add(themeframe,
                     text=_('Appearance'))  # Tab heading in settings

        # build plugin prefs tabs
        for plugin in plug.PLUGINS:
            #print(f'plug in pref {plugin.name}')
            plugframe = plugin.get_prefs(notebook, monitor.cmdr,
                                         monitor.is_beta)

            if plugframe:
                notebook.add(plugframe, text=plugin.name)

        # Plugin settings and info
        plugsframe = nb.Frame(notebook)
        plugsframe.columnconfigure(0, weight=1)
        plugdir = tk.StringVar()
        plugdir.set(config.plugin_dir)

        nb.Label(plugsframe, text=_('Plugins folder') + ':').grid(
            padx=PADX, sticky=tk.W)  # Section heading in settings
        plugdirentry = nb.Entry(plugsframe, justify=tk.LEFT)
        self.displaypath(plugdir, plugdirentry)
        plugdirentry.grid(row=10, padx=PADX, sticky=tk.EW)

        nb.Button(
            plugsframe,
            text=_('Open'),  # Button that opens a folder in Explorer/Finder
            command=lambda: webbrowser.open('file:///%s' % plugdir.get())
        ).grid(row=10, column=1, padx=(0, PADX), sticky=tk.NSEW)

        nb.Label(
            plugsframe,
            text=
            _("Tip: You can disable a plugin by{CR}adding '{EXT}' to its folder name"
              ).format(EXT='.disabled')).grid(  # Help text in settings
                  columnspan=2,
                  padx=PADX,
                  pady=10,
                  sticky=tk.NSEW)

        enabled_plugins = [x for x in plug.PLUGINS if x.folder and x.module]
        if len(enabled_plugins):
            ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                                 padx=PADX,
                                                                 pady=PADY * 8,
                                                                 sticky=tk.EW)
            nb.Label(plugsframe, text=_('Enabled Plugins') + ':').grid(
                padx=PADX, sticky=tk.W)  # List of plugins in settings
            for plugin in enabled_plugins:
                if plugin.name == plugin.folder:
                    label = nb.Label(plugsframe, text=plugin.name)
                else:
                    label = nb.Label(plugsframe,
                                     text='%s (%s)' %
                                     (plugin.folder, plugin.name))
                label.grid(columnspan=2, padx=PADX * 2, sticky=tk.W)

        disabled_plugins = [
            x for x in plug.PLUGINS if x.folder and not x.module
        ]
        if len(disabled_plugins):
            ttk.Separator(plugsframe, orient=tk.HORIZONTAL).grid(columnspan=3,
                                                                 padx=PADX,
                                                                 pady=PADY * 8,
                                                                 sticky=tk.EW)
            nb.Label(plugsframe, text=_('Disabled Plugins') + ':').grid(
                padx=PADX, sticky=tk.W)  # List of plugins in settings
            for plugin in disabled_plugins:
                nb.Label(plugsframe, text=plugin.name).grid(columnspan=2,
                                                            padx=PADX * 2,
                                                            sticky=tk.W)

        notebook.add(plugsframe, text=_('Plugins'))  # Tab heading in settings

        if platform == 'darwin':
            self.protocol("WM_DELETE_WINDOW",
                          self.apply)  # close button applies changes
        else:
            buttonframe = ttk.Frame(frame)
            buttonframe.grid(padx=PADX, pady=PADX, sticky=tk.NSEW)
            buttonframe.columnconfigure(0, weight=1)
            ttk.Label(buttonframe).grid(row=0, column=0)  # spacer
            button = ttk.Button(buttonframe, text=_('OK'), command=self.apply)
            button.grid(row=0, column=1, sticky=tk.E)
            button.bind("<Return>", lambda event: self.apply())
            self.protocol("WM_DELETE_WINDOW", self._destroy)

        # Selectively disable buttons depending on output settings
        self.cmdrchanged()

        # wait for window to appear on screen before calling grab_set
        self.parent.update_idletasks()
        self.parent.wm_attributes(
            '-topmost',
            0)  # needed for dialog to appear ontop of parent on OSX & Linux
        self.wait_visibility()
        self.grab_set()

        # Ensure fully on-screen
        if platform == 'win32' and CalculatePopupWindowPosition:
            position = RECT()
            GetWindowRect(GetParent(self.winfo_id()), position)
            if CalculatePopupWindowPosition(
                    POINT(parent.winfo_rootx(), parent.winfo_rooty()),
                    SIZE(position.right - position.left,
                         position.bottom - position.top), 0x10000, None,
                    position):
                self.geometry("+%d+%d" % (position.left, position.top))
示例#24
0
def plugin_prefs(parent: nb.Notebook, cmdr: str,
                 is_beta: bool) -> Optional[tk.Frame]:

    PADX = 10
    PADY = 2

    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    HyperlinkLabel(frame,
                   text="Fleet Carrier Management System",
                   background=nb.Label().cget("background"),
                   url=this.plugin_url,
                   underline=True).grid(row=8, padx=PADX, sticky=tk.W)
    nb.Label(frame, text="Version: %s" % this.version).grid(row=8,
                                                            column=1,
                                                            padx=PADX,
                                                            sticky=tk.E)

    nb.Label(frame).grid(sticky=tk.W)  # spacer

    this.cred_frame = nb.Frame(frame)  # credentials frame
    this.cred_frame.grid(columnspan=2, sticky=tk.EW)
    this.cred_frame.columnconfigure(1, weight=1)

    HyperlinkLabel(this.cred_frame,
                   text="FCMS credentials",
                   background=nb.Label().cget("background"),
                   url=this.apikey_url,
                   underline=True).grid(row=1,
                                        columnspan=2,
                                        padx=PADX,
                                        sticky=tk.W)

    nb.Label(this.cred_frame, text=_("Cmdr")).grid(row=10,
                                                   padx=PADX,
                                                   sticky=tk.W)
    this.cmdr_text = nb.Entry(this.cred_frame)
    this.cmdr_text.grid(row=10, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    nb.Label(this.cred_frame, text=_("Email")).grid(row=11,
                                                    padx=PADX,
                                                    sticky=tk.W)
    this.email = nb.Entry(this.cred_frame)
    this.email.grid(row=11, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    nb.Label(this.cred_frame, text=_("API Key")).grid(row=12,
                                                      padx=PADX,
                                                      sticky=tk.W)
    this.apikey = nb.Entry(this.cred_frame)
    this.apikey.grid(row=12, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    set_state_frame_childs(this.cred_frame, tk.NORMAL)
    this.cmdr_text.delete(0, tk.END)
    this.email.delete(0, tk.END)
    this.apikey.delete(0, tk.END)
    if cmdr:
        cred = get_credentials(cmdr)
        if cred:
            this.cmdr_text.insert(0, cred[0])
            this.email.insert(0, cred[1])
            this.apikey.insert(0, cred[2])

    if not cmdr or is_beta:
        set_state_frame_childs(this.cred_frame, tk.DISABLED)

    return frame
示例#25
0
文件: load.py 项目: WaferMouse/L3-37
def plugin_prefs(parent, cmdr, is_beta):
    service_providers = [
        ['none', 'None'],
        ['eddb', 'EDDB'],
        ['edsm', 'EDSM'],
        ['Inara', 'Inara'],
    ]
    frame = nb.Frame(parent)
    row = 0
    system_frame = nb.Frame(frame, relief=tk.GROOVE)
    system_provider_label = nb.Label(
        system_frame,
        text="System information provider override: ",
        justify=tk.LEFT)
    system_provider_label.grid(column=0, row=row, pady=2, padx=2)
    row = row + 1
    this.system_provider_select = tk.StringVar()
    for mode in service_providers:
        b = nb.Radiobutton(system_frame,
                           text=mode[1],
                           variable=this.system_provider_select,
                           value=mode[0])
        b.grid(column=0, row=row, sticky="W", padx=1)
        row = row + 1
    b.grid_configure(pady=2)
    try:
        this.system_provider_select.set(config.get_str('L3_system_provider'))
    except:
        this.system_provider_select.set("none")
    system_frame.grid(sticky="nsew")
    row = 0
    station_frame = nb.Frame(frame, relief=tk.GROOVE)
    station_provider_label = nb.Label(
        station_frame,
        text="Station information provider override: ",
        justify=tk.LEFT)
    station_provider_label.grid(column=0, row=row, pady=2, padx=2)
    row = row + 1
    this.station_provider_select = tk.StringVar()
    try:
        this.station_provider_select.set(config.get_str('L3_station_provider'))
    except:
        this.station_provider_select.set("none")
    for mode in service_providers:
        b = nb.Radiobutton(station_frame,
                           text=mode[1],
                           variable=this.station_provider_select,
                           value=mode[0])
        b.grid(column=0, row=row, sticky="W", padx=1)
        row = row + 1
        b.grid_configure(pady=2)
        station_frame.grid(sticky="nsew")

    shipyard_frame = nb.Frame(frame, relief=tk.GROOVE)
    shipyard_provider_label = nb.Label(shipyard_frame,
                                       text="Fleet information provider: ",
                                       justify=tk.LEFT)
    shipyard_provider_label.grid(column=2, row=0, pady=2)
    this.shipyard_provider_select = tk.StringVar()
    try:
        this.shipyard_provider_select.set(
            config.get_str('L3_shipyard_provider'))
    except:
        this.shipyard_provider_select.set("EDSM")
    modes = ['EDSM', 'Inara']
    row = 0
    for mode in modes:
        b = nb.Radiobutton(shipyard_frame,
                           text=mode,
                           variable=this.shipyard_provider_select,
                           value=mode)
        b.grid(column=3, row=row, sticky="W", padx=1)
        row = row + 1
    b.grid_configure(pady=2)
    EDSM_id_label = nb.Label(
        shipyard_frame,
        text=
        "To view your ships in EDSM,\nenter the numbers that follow id/\nin the URL for your EDSM profile page: ",
        justify=tk.LEFT)
    EDSM_id_label.grid(column=2, row=2, pady=2)
    this.EDSM_id_entry = nb.Entry(shipyard_frame)
    this.EDSM_id_entry.grid(column=3, row=2)
    try:
        this.EDSM_id_entry.delete(0, tk.END)
        this.EDSM_id_entry.insert(0, config.get_str('EDSM_id'))
    except:
        pass
    shipyard_frame.grid(column=1, row=1, sticky="nsew")
    return frame
示例#26
0
def plugin_prefs(parent, cmdr, is_beta):
    PADX = 10
    PADY = 2  # close spacing
    row = 1
    frame = nb.Frame(parent)
    frame.columnconfigure(1, weight=1)

    this.ltd_p = tk.IntVar(value=config.getint("EP_track_LTD"))
    this.painite_p = tk.IntVar(value=config.getint("EP_track_Painite"))
    this.new_win = tk.IntVar(value=config.getint("EP_use_new_window"))
    this.win_trans = tk.IntVar(value=config.getint("EP_win_trans"))
    this.miss = tk.IntVar(value=config.getint("EP_miss"))
    this.cargo = tk.IntVar(value=config.getint("EP_track_cargo"))
    this.sound = tk.IntVar(value=config.getint("EP_sound"))

    this.ip_label = nb.Label(frame, text="Server IP")
    this.ip_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.server_ip = nb.Entry(frame)
    this.server_ip.grid(row=row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    row += 1
    this.port_label = nb.Label(frame, text="Server Port")
    this.port_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.server_port = nb.Entry(frame)
    this.server_port.grid(row=row,
                          column=1,
                          padx=PADX,
                          pady=PADY,
                          sticky=tk.EW)

    row += 1
    this.session_label = nb.Label(frame, text="Server room")
    this.session_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.server_session = nb.Entry(frame)
    this.server_session.grid(row=row,
                             column=1,
                             padx=PADX,
                             pady=PADY,
                             sticky=tk.EW)

    row += 1
    this.font_size_label = nb.Label(frame, text="font size")
    this.font_size_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.font_size = nb.Entry(frame)
    this.font_size.grid(row=row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    row += 1
    nb.Checkbutton(frame,
                   text='Play a sound when threshold is met',
                   variable=this.sound).grid(row=row,
                                             column=0,
                                             padx=PADX,
                                             pady=PADY,
                                             sticky=tk.EW)
    row += 1
    nb.Checkbutton(frame,
                   text='Display result on new window',
                   variable=this.new_win).grid(row=row,
                                               column=0,
                                               padx=PADX,
                                               pady=PADY,
                                               sticky=tk.EW)
    row += 1
    nb.Checkbutton(frame,
                   text='Make the window transparent (windows only)',
                   variable=this.win_trans).grid(row=row,
                                                 column=0,
                                                 padx=PADX,
                                                 pady=PADY,
                                                 sticky=tk.EW)
    row += 1
    nb.Checkbutton(
        frame,
        text=
        'Display a message if prospected asteroid doesn\'t meet requirement',
        variable=this.miss).grid(row=row,
                                 column=0,
                                 padx=PADX,
                                 pady=PADY,
                                 sticky=tk.EW)
    row += 1
    nb.Checkbutton(frame, text='Track your cargo',
                   variable=this.cargo).grid(row=row,
                                             column=0,
                                             padx=PADX,
                                             pady=PADY,
                                             sticky=tk.EW)

    row += 1
    this.my_color_label = nb.Label(frame, text="My Color : ")
    this.my_color_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.my_color = nb.Entry(frame)
    this.my_color.grid(row=row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    row += 1
    this.color_label = nb.Label(frame, text="Others Color : ")
    this.color_label.grid(row=row, padx=PADX, sticky=tk.W)
    this.color = nb.Entry(frame)
    this.color.grid(row=row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)

    row += 1
    nb.Checkbutton(frame,
                   text='Search for LTD greater than',
                   variable=this.ltd_p).grid(row=row,
                                             column=0,
                                             padx=PADX,
                                             pady=PADY,
                                             sticky=tk.EW)
    this.ltd_threshold = nb.Entry(frame)
    this.ltd_threshold.grid(row=row,
                            column=1,
                            padx=PADX,
                            pady=PADY,
                            sticky=tk.EW)

    row += 1
    nb.Checkbutton(frame,
                   text='Search for Painite greater than',
                   variable=this.painite_p).grid(row=row,
                                                 column=0,
                                                 padx=PADX,
                                                 pady=PADY,
                                                 sticky=tk.EW)
    this.painite_threshold = nb.Entry(frame)
    this.painite_threshold.grid(row=row,
                                column=1,
                                padx=PADX,
                                pady=PADY,
                                sticky=tk.EW)

    load_value()
    return frame
示例#27
0
def plugin_prefs(parent: nb.Notebook, cmdr: str, is_beta: bool) -> nb.Frame:
    global xpos_var, ypos_var, width_var, height_var
    xpos_var = tk.IntVar(value=int(config.get("edmcoverlay2_xpos") or 0))
    ypos_var = tk.IntVar(value=int(config.get("edmcoverlay2_ypos") or 0))
    width_var = tk.IntVar(value=int(config.get("edmcoverlay2_width") or 1920))
    height_var = tk.IntVar(
        value=int(config.get("edmcoverlay2_height") or 1080))
    frame = nb.Frame(parent)
    frame.columnconfigure(0, weight=1)
    PAD_X = 10
    PAD_Y = 2

    f0 = nb.Frame(frame)
    HyperlinkLabel(f0,
                   text="edmcoverlay2",
                   url="https://github.com/sersorrel/edmcoverlay2",
                   background=nb.Label().cget('background'),
                   underline=True).grid(row=0,
                                        column=0,
                                        sticky=tk.W,
                                        padx=(PAD_X, 0))
    nb.Label(f0, text="by Ash Holland").grid(row=0,
                                             column=1,
                                             sticky=tk.W,
                                             padx=(0, PAD_X))
    f0.grid(sticky=tk.EW)

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(padx=PAD_X,
                                                    pady=2 * PAD_Y,
                                                    sticky=tk.EW)

    f1 = nb.Frame(frame)
    nb.Label(f1, text="Overlay configuration:").grid(row=0,
                                                     column=0,
                                                     columnspan=3,
                                                     padx=PAD_X,
                                                     pady=PAD_Y,
                                                     sticky=tk.W)
    nb.Label(f1, text="X position").grid(row=1,
                                         column=0,
                                         padx=PAD_X,
                                         pady=(PAD_Y, 0),
                                         sticky=tk.E)
    nb.Entry(f1, textvariable=xpos_var).grid(row=1,
                                             column=1,
                                             columnspan=3,
                                             padx=(0, PAD_X),
                                             pady=PAD_Y,
                                             sticky=tk.W)
    nb.Label(f1, text="Y position").grid(row=2,
                                         column=0,
                                         padx=PAD_X,
                                         pady=(PAD_Y, 0),
                                         sticky=tk.E)
    nb.Entry(f1, textvariable=ypos_var).grid(row=2,
                                             column=1,
                                             columnspan=3,
                                             padx=(0, PAD_X),
                                             pady=PAD_Y,
                                             sticky=tk.W)
    nb.Label(f1, text="Width").grid(row=3,
                                    column=0,
                                    padx=PAD_X,
                                    pady=(PAD_Y, 0),
                                    sticky=tk.E)
    nb.Entry(f1, textvariable=width_var).grid(row=3,
                                              column=1,
                                              columnspan=3,
                                              padx=(0, PAD_X),
                                              pady=PAD_Y,
                                              sticky=tk.W)
    nb.Label(f1, text="Height").grid(row=4,
                                     column=0,
                                     padx=PAD_X,
                                     pady=(PAD_Y, 0),
                                     sticky=tk.E)
    nb.Entry(f1, textvariable=height_var).grid(row=4,
                                               column=1,
                                               columnspan=3,
                                               padx=(0, PAD_X),
                                               pady=PAD_Y,
                                               sticky=tk.W)
    f1.grid(sticky=tk.EW)

    ttk.Separator(frame, orient=tk.HORIZONTAL).grid(padx=PAD_X,
                                                    pady=2 * PAD_Y,
                                                    sticky=tk.EW)

    f2 = nb.Frame(frame)
    nb.Label(f2, text="Manual overlay controls:").grid(row=0,
                                                       column=0,
                                                       padx=PAD_X,
                                                       pady=PAD_Y)
    nb.Button(f2, text="Start overlay",
              command=lambda: start_overlay()).grid(row=0,
                                                    column=1,
                                                    padx=PAD_X,
                                                    pady=PAD_Y)
    nb.Button(f2, text="Stop overlay",
              command=lambda: stop_overlay()).grid(row=0,
                                                   column=2,
                                                   padx=PAD_X,
                                                   pady=PAD_Y)
    f2.grid(sticky=tk.EW)

    return frame
示例#28
0
    def prefs_ui(self, parent):
        frame = notebook.Frame(parent)
        frame.columnconfigure(1, weight=1)

        # Translators: this is shown in the preferences panel
        ttkHyperlinkLabel.HyperlinkLabel(
            frame,
            text=_(u"EDR website"),
            background=notebook.Label().cget('background'),
            url="https://github.com/lekeno/edr/",
            underline=True).grid(padx=10, sticky=tk.W)

        # Translators: this is shown in the preferences panel
        notebook.Label(frame, text=_(u'Credentials')).grid(padx=10,
                                                           sticky=tk.W)
        ttk.Separator(frame, orient=tk.HORIZONTAL).grid(columnspan=2,
                                                        padx=10,
                                                        pady=2,
                                                        sticky=tk.EW)
        # Translators: this is shown in the preferences panel
        cred_label = notebook.Label(
            frame, text=_(u'Log in with your EDR account for full access'))
        cred_label.grid(padx=10, columnspan=2, sticky=tk.W)

        notebook.Label(frame, text=_(u"Email")).grid(padx=10,
                                                     row=11,
                                                     sticky=tk.W)
        notebook.Entry(frame, textvariable=self._email).grid(padx=10,
                                                             row=11,
                                                             column=1,
                                                             sticky=tk.EW)

        notebook.Label(frame, text=_(u"Password")).grid(padx=10,
                                                        row=12,
                                                        sticky=tk.W)
        notebook.Entry(frame, textvariable=self._password,
                       show=u'*').grid(padx=10, row=12, column=1, sticky=tk.EW)

        # Translators: this is shown in the preferences panel as a heading for feedback options (e.g. overlay, audio cues)
        notebook.Label(frame, text=_(u"EDR Feedback:")).grid(padx=10,
                                                             row=14,
                                                             sticky=tk.W)
        ttk.Separator(frame, orient=tk.HORIZONTAL).grid(columnspan=2,
                                                        padx=10,
                                                        pady=2,
                                                        sticky=tk.EW)

        notebook.Checkbutton(frame,
                             text=_(u"Overlay"),
                             variable=self._visual_feedback).grid(padx=10,
                                                                  row=16,
                                                                  sticky=tk.W)
        notebook.Checkbutton(frame,
                             text=_(u"Sound"),
                             variable=self._audio_feedback).grid(padx=10,
                                                                 row=17,
                                                                 sticky=tk.W)

        if self.server.is_authenticated():
            self.status = _(u"authenticated.")
        else:
            self.status = _(u"not authenticated.")

        return frame
示例#29
0
def plugin_prefs(parent, cmdr, is_beta):
    """
    Return a TK Frame for adding to the EDMC settings dialog.
    """
    this.apikey = tk.StringVar(value=config.get("APIkey"))
    this.approvedatatransfer = tk.IntVar(value=config.getint("ADT"))

    frame = nb.Frame(parent)

    plugin_label = nb.Label(frame, text="IDA-BGS EDMC plugin v0.66")
    plugin_label.grid(padx=10, row=0, column=0, sticky=tk.W)

    HyperlinkLabel(frame,
                   text='Visit website',
                   background=nb.Label().cget('background'),
                   url='https://github.com/ZTiKnl/IDA-BGS',
                   underline=True).grid(padx=10, row=0, column=1, sticky=tk.W)

    empty_label = nb.Label(frame, text="")
    empty_label.grid(padx=10, row=1, column=0, columnspan=2, sticky=tk.W)

    apikey_label = nb.Label(
        frame, text="Enter your API key to authorize data transfers")
    apikey_label.grid(padx=10, row=2, column=0, sticky=tk.W)

    apikey_entry = nb.Entry(frame, textvariable=this.apikey)
    apikey_entry.grid(padx=10, row=2, column=1, sticky=tk.EW)

    data_label = nb.Label(
        frame,
        text=
        "Each data package is between 1KB - 5KB, only 1 data package is sent per FSD jump"
    )
    data_label.grid(padx=20, row=3, column=0, columnspan=2, sticky=tk.W)

    data_label = nb.Label(
        frame,
        text=
        "The only data sent is BGS faction data along with basic system details and a timestamp"
    )
    data_label.grid(padx=20, row=4, column=0, columnspan=2, sticky=tk.W)

    data_label = nb.Label(
        frame,
        text=
        "It also sends data about systems where IDA does NOT have a presence, but this data is ignored by the API"
    )
    data_label.grid(padx=20, row=5, column=0, columnspan=2, sticky=tk.W)

    empty_label = nb.Label(frame, text="")
    empty_label.grid(padx=10, row=6, column=0, columnspan=2, sticky=tk.W)

    optin_entry = nb.Checkbutton(frame,
                                 text=_('Send additional data'),
                                 variable=this.approvedatatransfer)
    optin_entry.grid(padx=10, row=7, column=0, columnspan=2, sticky=tk.EW)

    data_label = nb.Label(
        frame,
        text=
        "Each data package is between 2KB - 10KB, 1 data package is sent per event"
    )
    data_label.grid(padx=20, row=8, column=0, columnspan=2, sticky=tk.W)

    events_label = nb.Label(frame, text="Events that are processed:")
    events_label.grid(padx=20, row=9, column=0, columnspan=2, sticky=tk.W)

    events_label = nb.Label(frame, text="Mission Completed")
    events_label.grid(padx=30, row=10, column=0, columnspan=2, sticky=tk.W)

    events_label = nb.Label(frame, text="Sell Exploration Data")
    events_label.grid(padx=30, row=11, column=0, columnspan=2, sticky=tk.W)

    events_label = nb.Label(frame, text="Cash in Bounty Voucher")
    events_label.grid(padx=30, row=12, column=0, columnspan=2, sticky=tk.W)

    events_label = nb.Label(frame, text="Sell Cargo on Market")
    events_label.grid(padx=30, row=13, column=0, columnspan=2, sticky=tk.W)

    empty_label = nb.Label(frame, text="")
    empty_label.grid(padx=10, row=14, column=0, columnspan=2, sticky=tk.W)

    thirdparty_label = nb.Label(
        frame,
        text=
        "No data will be sold to third parties, and there are no tracking mechanisms trying to follow you"
    )
    thirdparty_label.grid(padx=10, row=15, column=0, columnspan=2, sticky=tk.W)

    return frame
示例#30
0
    def show_preferences(self, parent: nb.Notebook) -> tk.Frame:
        """Display preferences tab in UI."""
        # set up the primary frame for our assigned notebook tab
        frame = nb.Frame(parent)
        frame.columnconfigure(1, weight=1)
        frame.rowconfigure(1, weight=1)

        # create a style that will be used for telemetry's settings notebook
        style = ttk.Style()
        style.configure("TNB.TNotebook",
                        background=nb.Label().cget("background"))
        style.configure("TNB.TLabelFrame",
                        background=nb.Label().cget("background"))
        PADX = 10
        PADY = 2

        # add our own notebook to hold all the telemetry options
        tnb = ttk.Notebook(frame, style="TNB.TNotebook")
        tnb.grid(columnspan=2, padx=8, sticky=tk.NSEW)
        tnb.columnconfigure(1, weight=1)

        # broker connection settings
        tnb_comm = nb.Frame(tnb)
        tnb_comm.columnconfigure(1, weight=1)
        row = 0

        row += 1
        nb.Label(tnb_comm, text="[Required Settings]").grid(padx=PADX,
                                                            row=row,
                                                            sticky=tk.W)

        # mqtt broker address
        row += 1
        nb.Label(tnb_comm, text="Broker Address:").grid(padx=PADX,
                                                        row=row,
                                                        sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._broker_tk).grid(padx=PADX,
                                                              pady=PADY,
                                                              row=row,
                                                              column=1,
                                                              sticky=tk.EW)

        # mqtt broker port
        row += 1
        nb.Label(tnb_comm, text="Port:").grid(padx=PADX, row=row, sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._port_tk).grid(padx=PADX,
                                                            pady=PADY,
                                                            row=row,
                                                            column=1,
                                                            sticky=tk.EW)

        # mqtt qos
        row += 1
        nb.Label(tnb_comm, text="QoS:").grid(padx=PADX, row=row, sticky=tk.E)
        nb.OptionMenu(tnb_comm, self._qos_tk, self._qos_tk.get(), 0, 1,
                      2).grid(padx=PADX,
                              pady=PADY,
                              row=row,
                              column=1,
                              sticky=tk.W)

        # mqtt broker keepalive
        row += 1
        nb.Label(tnb_comm, text="Keepalive:").grid(padx=PADX,
                                                   row=row,
                                                   sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._keepalive_tk).grid(padx=PADX,
                                                                 pady=PADY,
                                                                 row=row,
                                                                 column=1,
                                                                 sticky=tk.EW)

        # mqtt client id
        row += 1
        nb.Label(tnb_comm, text="Client ID:").grid(padx=PADX,
                                                   row=row,
                                                   sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._client_id_tk).grid(padx=PADX,
                                                                 pady=PADY,
                                                                 row=row,
                                                                 column=1,
                                                                 sticky=tk.EW)

        # broker auth settings
        row += 1
        ttk.Separator(tnb_comm, orient=tk.HORIZONTAL).grid(columnspan=4,
                                                           padx=PADX,
                                                           pady=PADY * 4,
                                                           sticky=tk.EW,
                                                           row=row)
        row += 1
        nb.Label(tnb_comm, text="[Authentication]").grid(padx=PADX,
                                                         row=row,
                                                         sticky=tk.W)

        # mqtt username
        row += 1
        nb.Label(tnb_comm, text="Username:"******"Password:"******"[Encryption]").grid(padx=PADX,
                                                     row=row,
                                                     sticky=tk.W)

        # encryption
        row += 1
        nb.Checkbutton(
            tnb_comm,
            text="Encrypted Connection",
            variable=self._encryption_tk,
            command="",
        ).grid(padx=PADX, row=row, column=1, sticky=tk.W)

        # skip validation
        row += 1
        nb.Checkbutton(
            tnb_comm,
            text="Skip Certificate Verification",
            variable=self._tls_insecure_tk,
            command="",
        ).grid(padx=PADX, row=row, column=1, sticky=tk.W)

        # server ca certificate
        row += 1
        nb.Label(tnb_comm, text="Server Certificate (CA)").grid(padx=PADX,
                                                                row=row,
                                                                sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._ca_certs_tk).grid(padx=PADX,
                                                                pady=PADY,
                                                                row=row,
                                                                column=1,
                                                                sticky=tk.EW)

        # client certificate
        row += 1
        nb.Label(tnb_comm, text="Client Certificate").grid(padx=PADX,
                                                           row=row,
                                                           sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._certfile_tk).grid(padx=PADX,
                                                                pady=PADY,
                                                                row=row,
                                                                column=1,
                                                                sticky=tk.EW)

        # client key
        row += 1
        nb.Label(tnb_comm, text="Client Key").grid(padx=PADX,
                                                   row=row,
                                                   sticky=tk.E)
        nb.Entry(tnb_comm, textvariable=self._keyfile_tk).grid(padx=PADX,
                                                               pady=PADY,
                                                               row=row,
                                                               column=1,
                                                               sticky=tk.EW)

        # topic settings
        tnb_data = nb.Frame(tnb)
        tnb_data.columnconfigure(1, weight=1)
        row = 0

        # mqtt root topic
        row += 1
        nb.Label(tnb_data, text="Root Topic").grid(padx=PADX,
                                                   row=row,
                                                   sticky=tk.W)
        nb.Entry(tnb_data, textvariable=self._root_topic_tk).grid(padx=PADX,
                                                                  pady=PADY,
                                                                  row=row,
                                                                  column=1,
                                                                  sticky=tk.EW)

        # lowercase topics
        row += 1
        nb.Checkbutton(
            tnb_data,
            text="Convert all topics to lowercase",
            variable=self._lowercase_topics_tk,
            command="",
        ).grid(padx=PADX, row=row, sticky=tk.W)

        # dashboard
        row += 1
        nb.Checkbutton(
            tnb_data,
            text="Publish Dashboard",
            variable=self._dashboard_tk,
            command="",
        ).grid(padx=PADX, row=row, sticky=tk.W)
        nb.OptionMenu(
            tnb_data,
            self._dashboard_format_tk,
            self._dashboard_format_tk.get(),
            "Raw",
            "Processed",
        ).grid(padx=PADX, pady=PADY, row=row, column=1, sticky=tk.W)

        # journal
        row += 1
        nb.Checkbutton(
            tnb_data,
            text="Publish Journal",
            variable=self._journal_tk,
            command="",
        ).grid(padx=PADX, row=row, sticky=tk.W)
        nb.OptionMenu(
            tnb_data,
            self._journal_format_tk,
            self._journal_format_tk.get(),
            "Raw",
            "Processed",
        ).grid(padx=PADX, pady=PADY, row=row, column=1, sticky=tk.W)

        # location
        row += 1
        nb.Checkbutton(
            tnb_data,
            text="Publish Current System/Station",
            variable=self._location_tk,
            command="",
        ).grid(padx=PADX, row=row, sticky=tk.W)

        # state
        row += 1
        nb.Checkbutton(
            tnb_data,
            text="Publish EDMC State Tracking",
            variable=self._state_tk,
            command="",
        ).grid(padx=PADX, row=row, sticky=tk.W)

        # add the preferences tabs we've created to our assigned EDMC settings tab
        tnb.add(tnb_comm, text="Connection")
        tnb.add(tnb_data, text="Data")

        # plugin link and version
        HyperlinkLabel(
            frame,
            text="https://github.com/fasteddy516/EDMC-Telemetry/",
            background=nb.Label().cget("background"),
            url="https://github.com/fasteddy516/EDMC-Telemetry/",
            underline=True,
        ).grid(padx=PADX, pady=(1, 4), row=2, column=0, sticky=tk.W)
        nb.Label(frame, text=f"Plugin Version {self.plugin_version}").grid(
            padx=PADX, pady=(1, 4), row=2, column=1, sticky=tk.E)

        # mqtt link and version
        HyperlinkLabel(
            frame,
            text="https://github.com/eclipse/paho.mqtt.python/",
            background=nb.Label().cget("background"),
            url="https://github.com/eclipse/paho.mqtt.python",
            underline=True,
        ).grid(padx=PADX, pady=(1, 4), row=3, column=0, sticky=tk.W)
        nb.Label(frame, text=f"MQTT Version {mqtt_version}").grid(padx=PADX,
                                                                  pady=(1, 4),
                                                                  row=3,
                                                                  column=1,
                                                                  sticky=tk.E)

        return frame