Exemplo n.º 1
0
    def _ask_to_save(self):
        def func():
            _file = None
            files = [('Fishy File', '*.fishy')]

            while True:
                button = self._open_save_popup()
                if button == 0 and config.get("full_auto_rec_file"):
                    return open(config.get("full_auto_rec_file"), 'wb')

                if button == 1:
                    _file = asksaveasfile(mode='wb',
                                          filetypes=files,
                                          defaultextension=files)
                    if _file:
                        return _file

                if button == 2:
                    return None

        file: typing.BinaryIO = self.engine.get_gui().call_in_thread(
            func, block=True)
        if not file:
            return

        data = {"full_auto_path": self.timeline}
        pickle.dump(data, file)
        config.set("full_auto_rec_file", file.name)
        logging.info(
            f"saved {os.path.basename(file.name)} recording, and loaded it in player"
        )
        file.close()
Exemplo n.º 2
0
    def select_file():
        file = askopenfilename(filetypes=[('Python Files', '*.fishy')])
        if not file:
            logging.error("file not selected")
        else:
            config.set("full_auto_rec_file", file)
            logging.info(f"loaded {file}")

        file_name_label.set(file_name())
Exemplo n.º 3
0
def check_update(gui, manual_check=False):
    if not auto_update.upgrade_avail() or config.get("dont_ask_update", False):
        if manual_check:
            logging.info("No update is available.")
        return

    cv, hv = auto_update.versions()
    returns = [None, None]
    _show(gui, cv, hv, returns)
    [update_now, dont_ask_update] = returns
    if dont_ask_update:
        config.set("dont_ask_update", dont_ask_update)
    else:
        config.delete("dont_ask_update")

    if update_now:
        gui.engine.set_update(hv)
Exemplo n.º 4
0
def install_required_addons(force=False):
    addons_req = [libgps, lam2, fishyqr]
    addon_version = config.get("addon_version", {})
    installed = False
    for addon in addons_req:
        if force or (addon_exists(*addon) and
                     (addon[0] not in addon_version or
                      (addon[0] in addon_version
                       and addon_version[addon[0]] < addon[2]))):
            remove_addon(*addon)
            install_addon(*addon)
            addon_version[addon[0]] = addon[2]
            installed = True
    config.set("addon_version", addon_version)
    if installed:
        logging.info(
            "Please make sure to enable \"Allow outdated addons\" in ESO")
Exemplo n.º 5
0
def initialize(window_to_hide):
    helper.create_shortcut_first()
    helper.initialize_uid()

    new_session = web.get_session()
    if new_session is None:
        logging.error(
            "Couldn't create a session, some features might not work")
    print(f"created session {new_session}")

    try:
        is_admin = os.getuid() == 0
    except AttributeError:
        is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0
    if is_admin:
        logging.info("Running with admin privileges")

    try:
        if helper.upgrade_avail() and not config.get("dont_ask_update", False):
            cv, hv = helper.versions()
            update_now, dont_ask_update = update_dialog.start(cv, hv)
            if dont_ask_update:
                config.set("dont_ask_update", dont_ask_update)
            else:
                config.delete("dont_ask_update")

            if update_now:
                helper.auto_upgrade()
    except Exception:
        logging.error(traceback.format_exc())

    if not config.get("debug", False) and check_window_name(
            win32gui.GetWindowText(window_to_hide)):
        win32gui.ShowWindow(window_to_hide, win32con.SW_HIDE)
        helper.install_thread_excepthook()
        sys.excepthook = helper.unhandled_exception_logging

    if not config.get("addoninstalled", 0) or helper.get_addonversion(
            chalutier[0]) < chalutier[2]:
        helper.install_addon(*chalutier)
        helper.install_addon(*lam2)
        helper.remove_addon(
            "ProvisionsChalutier")  #TODO delete with fishy 0.4.6
        helper.remove_addon("FooAddon")  #TODO delete with fishy 0.4.6
    config.set("addoninstalled", helper.get_addonversion(chalutier[0]))
Exemplo n.º 6
0
 def start_engine():
     config.set("last_started", self.gui._engine_var.get())
     self.gui.engines[self.gui._engine_var.get()][1]()
Exemplo n.º 7
0
 def accept():
     config.set("eula", True)
     root.destroy()
Exemplo n.º 8
0
def _update_factor(key, value):
    full_auto_factors = config.get("full_auto_factors", {})
    full_auto_factors[key] = value
    config.set("full_auto_factors", full_auto_factors)
Exemplo n.º 9
0
 def run(self):
     self._walk_calibrate()
     self._rotate_calibrate()
     config.set("calibrate", False)
     logging.info("calibration done")
Exemplo n.º 10
0
def create_shortcut_first():
    from .config import config

    if not config.get("shortcut_created", False):
        create_shortcut(False)
        config.set("shortcut_created", True)
Exemplo n.º 11
0
 def mode_command():
     config.set("full_auto_mode", mode_var.get())
     edit_cb['state'] = "normal" if config.get(
         "full_auto_mode", 0) == FullAutoMode.Recorder.value else "disable"
Exemplo n.º 12
0
 def start_calibrate():
     top.quit_top()
     config.set("calibrate", True)
     gui.engine.toggle_fullfisher()
Exemplo n.º 13
0
def start_fullfisher_config(gui: 'GUI'):
    top = PopUp(helper.empty_function,
                gui._root,
                background=gui._root["background"])
    controls_frame = ttk.Frame(top)
    top.title("Config")

    def file_name():
        file = config.get("full_auto_rec_file", None)
        if file is None:
            return "Not Selected"
        return os.path.basename(file)

    def select_file():
        file = askopenfilename(filetypes=[('Python Files', '*.fishy')])
        if not file:
            logging.error("file not selected")
        else:
            config.set("full_auto_rec_file", file)
            logging.info(f"loaded {file}")

        file_name_label.set(file_name())

    def start_calibrate():
        top.quit_top()
        config.set("calibrate", True)
        gui.engine.toggle_fullfisher()

    def mode_command():
        config.set("full_auto_mode", mode_var.get())
        edit_cb['state'] = "normal" if config.get(
            "full_auto_mode", 0) == FullAutoMode.Recorder.value else "disable"

    # todo repetitive code fix
    file_name_label = tk.StringVar(value=file_name())
    mode_var = tk.IntVar(value=config.get("full_auto_mode", 0))
    edit_var = tk.IntVar(value=config.get("edit_recorder_mode", 0))
    tabout_var = tk.IntVar(value=config.get("tabout_stop", 1))
    look_for_hole = tk.IntVar(value=config.get("look_for_hole", 1))
    row = 0

    ttk.Label(controls_frame, text="Calibration: ").grid(row=row,
                                                         column=0,
                                                         pady=(5, 0))
    ttk.Button(controls_frame, text="RUN",
               command=start_calibrate).grid(row=row, column=1)

    row += 1

    ttk.Label(controls_frame, text="Mode: ").grid(row=row, column=0, rowspan=2)
    ttk.Radiobutton(controls_frame,
                    text="Player",
                    variable=mode_var,
                    value=FullAutoMode.Player.value,
                    command=mode_command).grid(row=row,
                                               column=1,
                                               sticky="w",
                                               pady=(5, 0))
    row += 1
    ttk.Radiobutton(controls_frame,
                    text="Recorder",
                    variable=mode_var,
                    value=FullAutoMode.Recorder.value,
                    command=mode_command).grid(row=2, column=1, sticky="w")

    row += 1

    ttk.Label(controls_frame, text="Edit Mode: ").grid(row=row, column=0)
    edit_state = tk.NORMAL if config.get(
        "full_auto_mode", 0) == FullAutoMode.Recorder.value else tk.DISABLED
    edit_cb = ttk.Checkbutton(
        controls_frame,
        variable=edit_var,
        state=edit_state,
        command=lambda: config.set("edit_recorder_mode", edit_var.get()))
    edit_cb.grid(row=row, column=1, pady=(5, 0))

    row += 1

    ttk.Label(controls_frame, text="Tabout Stop: ").grid(row=row, column=0)
    ttk.Checkbutton(
        controls_frame,
        variable=tabout_var,
        command=lambda: config.set("tabout_stop", tabout_var.get())).grid(
            row=row, column=1, pady=(5, 0))

    row += 1

    ttk.Label(controls_frame, text="Look for hole: ").grid(row=row, column=0)
    ttk.Checkbutton(
        controls_frame,
        variable=look_for_hole,
        command=lambda: config.set("look_for_hole", look_for_hole.get())).grid(
            row=row, column=1, pady=(5, 0))

    row += 1

    ttk.Label(controls_frame, text="Fishy file: ").grid(row=row,
                                                        column=0,
                                                        rowspan=2)
    ttk.Button(controls_frame, text="Select",
               command=select_file).grid(row=row, column=1, pady=(5, 0))
    row += 1
    ttk.Label(controls_frame, textvariable=file_name_label).grid(row=row,
                                                                 column=1,
                                                                 columnspan=2)

    row += 1

    ttk.Label(controls_frame,
              text="Use semi-fisher config for rest").grid(row=row,
                                                           column=0,
                                                           columnspan=2,
                                                           pady=(20, 0))

    controls_frame.pack(padx=(5, 5), pady=(5, 10))
    controls_frame.update()

    top.start()