示例#1
0
def search_db(sender, data):
    simple.hide_item("Create Document from Template")
    session = Session()
    vars = session.query(Variable).order_by(Variable.name.asc())
    with simple.window(f"Search in DB ({data.split('_')[0]})",
                       **default_window()):
        core.add_text("All variables")
        for var in vars:
            core.add_input_text(
                f"{var.name}_name_search",
                label="",
                width=150,
                enabled=False,
                default_value=var.name,
            )
            core.add_same_line(spacing=10)
            core.add_input_text(
                f"{var.name}_content_search",
                label="",
                width=300,
                enabled=False,
                default_value=var.content,
            )
            core.add_same_line(spacing=10)
            core.add_button(
                f"{var.name}_update_button_search",
                label="Use this value",
                callback=use_value,
                callback_data=((data, var.content)),
            )
        core.add_button(
            "button_db_close",
            label="Close Window",
            callback=close_popup,
        )
示例#2
0
def add_db():
    simple.hide_item("Create Document from Template")
    with simple.window("Add Variable to DB", **default_window()):
        core.add_text("Variable Name".ljust(23))
        core.add_same_line(spacing=10)
        core.add_text("Variable Content")
        core.add_input_text(
            "name_db_add",
            label="",
            width=150,
        )
        core.add_same_line(spacing=10)
        core.add_input_text(
            "content_db_add",
            label="",
            width=300,
        )
        core.add_button(
            "button_db_add",
            label="Add Variable",
            callback=add_variable_gui,
            callback_data=("name_db_add", "content_db_add"),
        )
        core.add_button(
            "button_db_close",
            label="Close Window",
            callback=close_popup,
        )
示例#3
0
 def compose_workout(self):
     equipment_val = core.get_value("Equipment##widget")
     exercise_type_val = core.get_value("Exercise Type##widget")
     muscle_group_val = core.get_value("Muscle Group##widget")
     if not equipment_val or not exercise_type_val or not muscle_group_val:
         simple.show_item("Fill all the inputs, please.")
     else:
         simple.hide_item("workout_composition_group")
         self._composed_workout = workout_services.get_composed_workout(
             equipment_val, exercise_type_val, muscle_group_val)
         core.add_group(name="buttons", parent="workout_execution_group")
         core.add_table(
             "workout_table",
             ["Exercise", "Sets", "Reps", "Example"],
             parent="workout_execution_group",
             callback=self.toggle,
         )
         for workout in self._composed_workout:
             core.add_row("workout_table", list(workout.values()))
         core.add_button("Cancel##widget",
                         callback=self.cancel_workout,
                         parent="buttons")
         core.add_button("Clear##widget",
                         callback=self.clear_table,
                         parent="buttons")
         core.add_button("Save##widget",
                         callback=self.save_workout,
                         parent="buttons")
示例#4
0
 def generate_workout_tab(self):
     core.add_spacing(count=10)
     core.add_group(name="workout_execution_group")
     core.add_group(name="workout_composition_group")
     core.add_combo(
         "Equipment##widget",
         items=workout_services.get_criterias_by_name("Equipment"),
         parent="workout_composition_group",
     )
     core.add_spacing(count=4, parent="workout_composition_group")
     core.add_combo(
         "Exercise Type##widget",
         items=workout_services.get_criterias_by_name("Exercise Type"),
         parent="workout_composition_group",
     )
     core.add_spacing(count=4, parent="workout_composition_group")
     core.add_combo(
         "Muscle Group##widget",
         items=workout_services.get_criterias_by_name("Major Muscle"),
         parent="workout_composition_group",
     )
     core.add_spacing(count=4, parent="workout_composition_group")
     core.add_button(
         "Compose Workout##widget",
         parent="workout_composition_group",
         callback=self.compose_workout,
     )
     core.add_text(
         "Fill all the inputs, please.",
         color=[255, 0, 0],
         parent="workout_composition_group",
     )
     simple.hide_item("Fill all the inputs, please.")
示例#5
0
def open_app_overlay(faceit_name):
    height = config_functions.check_for_layout()
    hwnd = win32gui.GetForegroundWindow()
    win32gui.MoveWindow(hwnd, 0, 0, 208, height[0] + 39, True)
    simple.hide_item("##Overlay")
    simple.hide_item("##Config")
    win32gui.SetWindowText(hwnd, f"{faceit_name} Elo")
    eloOverlay.show_main()
示例#6
0
 def compose_workout(self):
     equipment_val = core.get_value("Equipment##widget")
     exercise_type_val = core.get_value("Exercise Type##widget")
     muscle_group_val = core.get_value("Muscle Group##widget")
     if not equipment_val or not exercise_type_val or not muscle_group_val:
         simple.show_item("Fill all the inputs, please.")
     else:
         self.composed_workout = get_composed_workout(
             equipment_val, exercise_type_val, muscle_group_val)
         simple.hide_item("workout_composition_group")
         core.add_table("Workout", ["Exercise", "Sets", "Reps", "Example"],
                        callback=self.toggle)
         for el in self.composed_workout:
             core.add_row("Workout", list(el.values()))
         core.add_button("Cancel##widget")
         core.add_button("Save##widget")
 def add_login_els(self):
     core.add_input_text("Username##login",
                         on_enter=True,
                         parent="login_els")
     core.add_input_text(
         "Password##login",
         password=True,
         on_enter=True,
         parent="login_els",
     )
     core.add_button("Log in", callback=self.log_in, parent="login_els")
     core.add_button("Create an account",
                     callback=self.show_signup_els,
                     parent="login_els")
     core.add_text("Incorrect Password", color=[255, 0, 0])
     core.add_text("Please, fill all the inputs", color=[255, 0, 0])
     simple.hide_item("Incorrect Password")
     simple.hide_item("Please, fill all the inputs")
示例#8
0
def edit_db():
    simple.hide_item("Create Document from Template")
    session = Session()
    vars = session.query(Variable).order_by(Variable.name.asc())
    with simple.window("Edit Variable DB", **default_window()):
        core.add_text("All variables")
        for var in vars:
            with simple.group(f"{var.name}_group"):
                core.add_input_text(
                    f"{var.name}_name_db",
                    label="",
                    width=150,
                    enabled=False,
                    default_value=var.name,
                )
                core.add_same_line(spacing=10)
                core.add_input_text(
                    f"{var.name}_content_db",
                    label="",
                    width=300,
                    default_value=get_content(var.content),
                )
                core.add_same_line(spacing=10)
                core.add_button(
                    f"{var.name}_update_button_db",
                    label="Update",
                    callback=save_or_update_db,
                    callback_data=(f"{var.name}_name_db",
                                   f"{var.name}_content_db"),
                )
                core.add_same_line(spacing=10)
                core.add_button(
                    f"{var.name}_delete_button_db",
                    label="Delete",
                    callback=remove_variable_gui,
                    callback_data=argparse.Namespace(name=var.name),
                )
        core.add_button(
            "close_button_db",
            label="Close Window",
            callback=close_popup,
        )
 def show_signup_els(self):
     self.cancel_login()
     core.add_input_text("Username##signup",
                         on_enter=True,
                         parent="signup_els")
     core.add_input_text("Email##signup",
                         on_enter=True,
                         parent="signup_els")
     core.add_input_text(
         "Password##signup",
         password=True,
         on_enter=True,
         parent="signup_els",
     )
     core.add_button("Cancel",
                     callback=self.cancel_signup,
                     parent="signup_els")
     core.add_button("Sign up", callback=self.sign_up, parent="signup_els")
     core.add_text("Please, fill all the inputs", color=[255, 0, 0])
     core.add_text("Something went wrong", color=[255, 0, 0])
     simple.hide_item("Please, fill all the inputs")
     simple.hide_item("Something went wrong")
示例#10
0
    def layer_slider_callback(self):
        for i in range(0, self.maxNumberOfLayers):
            simple.hide_item(self.layer + str(i))
            simple.hide_item(self.type + '##' + str(i))
            simple.hide_item(self.activation + '##' + str(i))

        for i in range(0, core.get_value(self.numberOfLayers)):
            simple.show_item(self.layer + str(i))
            simple.show_item(self.type + '##' + str(i))
            simple.show_item(self.activation + '##' + str(i))
示例#11
0
class Menu:
    def theme_setting(sender, data):
        core.set_theme(data)

    def dump_db():
        user_services.delete_records_by_username()

    with simple.window("Main Window",
                       no_title_bar=True,
                       autosize=True,
                       no_resize=True):
        with simple.menu_bar(name="Main Menu"):
            with simple.menu(name="Settings"):
                with simple.menu("Theme"):
                    core.add_menu_item("Dark",
                                       callback=theme_setting,
                                       callback_data="Dark")
                    core.add_menu_item("Light",
                                       callback=theme_setting,
                                       callback_data="Light")
                    core.add_menu_item("Classic",
                                       callback=theme_setting,
                                       callback_data="Classic")
                    core.add_menu_item("Dark 2",
                                       callback=theme_setting,
                                       callback_data="Dark 2")
                    core.add_menu_item("Grey",
                                       callback=theme_setting,
                                       callback_data="Grey")
                    core.add_menu_item("Dark Grey",
                                       callback=theme_setting,
                                       callback_data="Dark Grey")
                    core.add_menu_item("Cherry",
                                       callback=theme_setting,
                                       callback_data="Cherry")
                    core.add_menu_item("Purple",
                                       callback=theme_setting,
                                       callback_data="Purple")
                    core.add_menu_item("Gold",
                                       callback=theme_setting,
                                       callback_data="Gold")
                    core.add_menu_item("Red",
                                       callback=theme_setting,
                                       callback_data="Red")
                with simple.menu(name="Database"):
                    core.add_menu_item("Dump database", callback=dump_db)
        core.add_spacing(count=10)
    simple.hide_item("Main Menu")
示例#12
0
 def hide_window(self):
     simple.hide_item(self.windowName)
     self.hidden = True
示例#13
0
 def cb(*args):
     dpg_simple.hide_item(self._status_id)
     dpg_simple.hide_item(self._status_id_same_line)
    def HideWindow(self):

        simple.hide_item(self._window_name)
示例#15
0
def show_main():
    logging.info("start show_main")
    global start_threading
    heigh, iCountMatch, iCountFaceit = config_functions.check_for_layout()
    name = config_functions.get_faceit_name_from_db()
    with simple.window(f"{name} Elo",
                       height=heigh,
                       width=190,
                       no_title_bar=True,
                       no_resize=True,
                       on_close=lambda: delete_item("FACEIT Elo Overlay"),
                       x_pos=200):
        logging.info("Build the window")
        simple.set_window_pos(f"{name} Elo", 0, 0)
        core.set_main_window_title(f"{name} Elo")
        core.set_main_window_size(width=250, height=heigh)
        # Now the magic happens !
        core.set_style_frame_rounding(6.00)
        with simple.group("##Loading"):
            core.add_spacing(count=20)
            core.add_text("##LoadingText",
                          default_value="Getting data from Faceit servers")
        """
        Get Data from the API
        """
        winLoss = config_functions.get_win_loss()
        if winLoss[0][0] == "1":
            mode = 0
        else:
            mode = 1
        logging.info("Get data from the API")
        iElo, acEloToday, iRank, \
        acResult, acScore, acKd, \
        acMap, iStreak, iMatches, \
        iMatchesWon, acEloDiff, iKills, \
        iDeath, iWin, iLoss = faceit_api.get_faceit_data_from_api(mode)
        """
        Build the Faceit Header and Data
        """
        if iCountFaceit > 0:
            logging.info("Build the window for Faceit stats")
            add_faceit(iElo, iRank, acEloToday, iStreak, iMatches, iMatchesWon,
                       iWin, iLoss)
        """
        Build the Last Game Header and Data
        """
        if iCountMatch > 0:
            logging.info("Build the window for Match stats")
            add_last_game(acMap, acResult, acScore, acKd, acEloDiff, iKills,
                          iDeath)
        """
        ! Add some promotion !
        """
        core.add_spacing(count=1)
        core.add_text("powered by Dear PyGui")
        core.add_same_line()
        core.add_image("image##DPG", "resources/6727dpg.ico")
        simple.hide_item("##Loading")
        core.enable_docking(dock_space=False)
        hwnd = win32gui.GetForegroundWindow()
        win32gui.SetWindowText(hwnd, f"{name} Elo")
        start_threading = 1
        long_process()