Example #1
0
    def enable_docking(**kwargs):
        """Enable docking and set docking options.

        Note:
            Once docking is enabled, it cannot be disabled.

        Keyword Arguments:
            shift_only: if ``True``, hold down shift for docking.
                If ``False``, dock by dragging window titlebars.
            dock_space: if ``True``, windows will be able to dock
                with the main window viewport.
        """
        dpgcore.enable_docking(**kwargs)
Example #2
0
    def __init__(self):
        core.set_style_item_spacing(1, 1)
        core.set_style_window_padding(0, 0)
        core.enable_docking(shift_only=False, dock_space=True)
        core.set_main_window_size(690, 450)

        root = os.path.dirname(__file__)
        self.__configFile = f'{root}/config.json'

        with simple.window("main"):
            with simple.group("test", width=200):
                core.add_button("button1")

        core.add_window()
        with simple.window("floaty", ):
            with simple.group("test", width=200):
                core.add_button("button1")

        core.set_exit_callback(self.__exit)
        self.__configLoad()
Example #3
0
from dearpygui import core, simple
from settings_window import SettingsWindow

core.enable_docking()
settingsWindow = SettingsWindow()

core.set_main_window_title("NeuronApplication")
with simple.window('MainWindow'):
    core.add_menu_bar("MenuBar")
    with simple.menu("Motyw##demo"):
        core.add_menu_item("Ciemny", callback=lambda sender, data: core.set_theme("Dark"), check=True)
        core.add_menu_item("Jasny", callback=lambda sender, data: core.set_theme("Light"), check=True)
        core.add_menu_item("Klasyczny", callback=lambda sender, data: core.set_theme("Classic"), check=True)
        core.add_menu_item("Ciemny 2", callback=lambda sender, data: core.set_theme("Dark 2"), check=True)
        core.add_menu_item("Szary", callback=lambda sender, data: core.set_theme("Grey"), check=True)
        core.add_menu_item("Ciemno-Szary", callback=lambda sender, data: core.set_theme("Dark Grey"), check=True)
        core.add_menu_item("Wisniowy", callback=lambda sender, data: core.set_theme("Cherry"), check=True)
        core.add_menu_item("Purpurowy", callback=lambda sender, data: core.set_theme("Purple"), check=True)
        core.add_menu_item("Zloty", callback=lambda sender, data: core.set_theme("Gold"), check=True)
        core.add_menu_item("Czerwony", callback=lambda sender, data: core.set_theme("Red"), check=True)
    with simple.menu("Pozycja"):
        core.add_menu_item("Zresetuj wszystko", callback=lambda sender, data: settingsWindow.reset_all())
        pass
    with simple.menu("Ukryj"):
        core.add_menu_item("Okno ustawien", callback = lambda sender, data: settingsWindow.toggle_visibility())
        core.add_menu_item("Wizualizacja sieci", callback = lambda sender, data: settingsWindow.betterVisualizer.toggle_visibility())
        core.add_menu_item("Wczytaj plik", callback = lambda sender, data: settingsWindow.importWindow.toggle_visibility())
        core.add_menu_item("Odpowiedz sieci", callback = lambda sender, data: settingsWindow.outputVisualisationWindow.toggle_visibility())
        core.add_menu_item("Historia uczenia##temp2", callback = lambda sender, data: settingsWindow.historyGraphWindow.toggle_visibility())

Example #4
0
def start_build_dpg():
    with simple.window("FACEIT Elo Overlay",
                       on_close=lambda: delete_item("FACEIT Elo Overlay"),
                       no_title_bar=True,
                       no_resize=True):
        """
        Set window configurations
        """

        simple.set_window_pos("FACEIT Elo Overlay", 0, 0)
        core.set_main_window_title("FACEIT Elo Overlay")
        core.set_main_window_size(492, 830)
        core.set_style_frame_rounding(6.00)
        core.add_additional_font("resources/OpenSans-Bold.ttf", size=14.5)
        """
        Initial loads
        """
        db_create.create_database(DBNAME)
        COLOR_List = config_functions.get_color()
        """
        Set some Background and Font Colors
        also the frame rounding and the window size
        """
        core.set_theme_item(mvGuiCol_Text, COLOR_List[1][0], COLOR_List[1][1],
                            COLOR_List[1][2], COLOR_List[1][3])
        core.set_theme_item(mvGuiCol_WindowBg, COLOR_List[3][0],
                            COLOR_List[3][1], COLOR_List[3][2],
                            COLOR_List[3][3])
        core.set_theme_item(mvGuiCol_Border, COLOR_List[4][0],
                            COLOR_List[4][1], COLOR_List[4][2],
                            COLOR_List[4][3])
        core.set_style_frame_border_size(1.00)
        core.set_theme_item(mvGuiCol_Button, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2],
                            COLOR_List[0][3])
        core.set_theme_item(mvGuiCol_ButtonHovered, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2],
                            COLOR_List[0][3])
        core.set_theme_item(mvGuiCol_ButtonActive, COLOR_List[2][0],
                            COLOR_List[2][1], COLOR_List[2][2],
                            COLOR_List[2][3])
        core.set_theme_item(mvGuiCol_BorderShadow, COLOR_List[0][0],
                            COLOR_List[0][1], COLOR_List[0][2] - 50,
                            COLOR_List[0][3])

    with simple.window('##Overlay',
                       no_collapse=True,
                       no_resize=True,
                       no_move=True,
                       no_close=True,
                       x_pos=30,
                       y_pos=0,
                       width=445,
                       height=790,
                       no_title_bar=True):
        """
        Set a Header 
        """
        bool_list_faceit, bool_list_match, name, acEloGoal = startup()
        core.add_button("FACEIT Overlay Menu")
        core.set_item_style_var("FACEIT Overlay Menu",
                                mvGuiStyleVar_FramePadding, [5 * 27, 5 * 3])
        core.add_spacing(count=5)
        """
        Build up the FACEIT Stats configuration 
        """

        with simple.group("##GroupStats"):
            core.add_button("Default Configurations##STATS")
            core.set_item_style_var("Default Configurations##STATS",
                                    mvGuiStyleVar_FramePadding,
                                    [5 * 20, 5 * 3])
            core.add_spacing(count=5)
            core.add_text("##TextFaceitName",
                          default_value="FACEIT Name:",
                          color=(255, 255, 0, -1))
            core.add_input_text("##FaceitName",
                                hint="FACEIT Name Case sensitive",
                                default_value=name,
                                callback=changes_detected)
            core.add_spacing(count=2)
            core.add_text("##TextEloGoal", default_value="FACEIT Elo goal:")
            core.add_input_text("##EloGoal",
                                hint="Set your Elo goal, empty = disabled",
                                default_value=str(acEloGoal),
                                callback=changes_detected)
            core.add_spacing(count=5)
            """
            Faceit Stats header 
            """
            core.add_button("FACEIT Stats")
            core.set_item_style_var("FACEIT Stats", mvGuiStyleVar_FramePadding,
                                    [5 * 26, 5 * 3])
            core.add_spacing(count=2)
            """
            Checkbox group 
            """
            core.add_checkbox(
                "Disable All##stats",
                default_value=False,
                callback=lambda sender, data: disable_all(sender))
            core.add_same_line()
            core.add_checkbox("Enable All##stats",
                              default_value=False,
                              callback=lambda sender, data: enable_all(sender))
            core.add_spacing(count=3)
            """
            Checkbox group 
            """
            core.add_checkbox("Current Elo##stats",
                              default_value=bool_list_faceit[0],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Faceit Rank##stats",
                              default_value=bool_list_faceit[1],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Elo Gained today##stats",
                              default_value=bool_list_faceit[2],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Win Streak##stats",
                              default_value=bool_list_faceit[3],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Total Matches##stats",
                              default_value=bool_list_faceit[4],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Matches Won##stats",
                              default_value=bool_list_faceit[5],
                              callback=changes_detected)
            core.add_spacing(count=2)
            win_loss = config_functions.get_win_loss()
            print(win_loss)
            if win_loss[0][0] is None:
                win_loss = [(0, 0)]
            core.add_text("##TextWinLoss", default_value="Win/Loss Stats:")
            core.add_checkbox("Day##WinLoss",
                              default_value=int(win_loss[0][0]),
                              callback=lambda sender, data: win_los(sender))
            core.add_same_line()
            core.add_checkbox("Week##WinLoss",
                              default_value=int(win_loss[0][1]),
                              callback=lambda sender, data: win_los(sender))
            core.add_spacing(count=5)
            """
            Last Match header 
            """
            core.add_button("Last Match")
            core.set_item_style_var("Last Match", mvGuiStyleVar_FramePadding,
                                    [5 * 26.5, 5 * 3])
            core.add_spacing(count=2)
            """
            Checkbox group 
            """
            core.add_checkbox(
                "Disable All##match",
                default_value=False,
                callback=lambda sender, data: disable_all(sender))
            core.add_same_line()
            core.add_checkbox("Enable All##match",
                              default_value=False,
                              callback=lambda sender, data: enable_all(sender))
            core.add_spacing(count=3)
            """
            Checkbox group 
            """
            core.add_checkbox("Score##match",
                              default_value=bool_list_match[0],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Result (W/L)##match",
                              default_value=bool_list_match[1],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Map##match",
                              default_value=bool_list_match[2],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("K/D##match",
                              default_value=bool_list_match[3],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Elo Diff##match",
                              default_value=bool_list_match[4],
                              callback=changes_detected)
            core.add_same_line(xoffset=250)
            core.add_checkbox("Kills##match",
                              default_value=bool_list_match[5],
                              callback=changes_detected)
            """
            Checkbox group 
            """
            core.add_checkbox("Death##match",
                              default_value=bool_list_match[6],
                              callback=changes_detected)
            core.add_spacing(count=5)
            """
            Apply Configuration to the database Button 
            """
            core.add_button("Apply Configuration", callback=save_data)
        """
        Start the Overlay with the current configuration 
        """
        core.add_spacing(count=3)
        core.add_button("Start", callback=open_overlay)
        core.set_item_style_var("Start", mvGuiStyleVar_FramePadding,
                                [5 * 29.5, 5 * 3])

    with simple.window('##Config',
                       no_collapse=True,
                       no_resize=True,
                       no_move=True,
                       no_close=True,
                       x_pos=0,
                       y_pos=1,
                       width=20,
                       height=790,
                       no_title_bar=True):
        core.set_item_color("##Config",
                            mvGuiCol_Text,
                            color=(COLOR_List[1][0], COLOR_List[1][1],
                                   COLOR_List[1][2], COLOR_List[1][3]))
        core.set_item_color("##Config",
                            mvGuiCol_WindowBg,
                            color=(COLOR_List[3][0], COLOR_List[3][1],
                                   COLOR_List[3][2], COLOR_List[3][3] - 10))
        core.set_item_style_var("##Config",
                                mvGuiStyleVar_WindowRounding,
                                value=[6])
        core.set_item_color("##Config",
                            mvGuiCol_Border,
                            color=(COLOR_List[4][0], COLOR_List[4][1],
                                   COLOR_List[4][2], COLOR_List[4][3]))
        core.add_image_button("##ConfigPlus",
                              value="resources/cfg_wheel.png",
                              callback=animation_config_color,
                              frame_padding=1,
                              tip="Settings & Colors")
        core.add_same_line(xoffset=50)
        with simple.group("##Config_Colors", show=False):
            COLOR_List = config_functions.get_color()
            core.add_text(
                "You can type in the RBG Values or click on the right Color Button"
            )

            core.add_color_edit4(name="Header#Color",
                                 default_value=[
                                     COLOR_List[0][0], COLOR_List[0][1],
                                     COLOR_List[0][2], COLOR_List[0][3]
                                 ],
                                 label="Header")
            core.add_color_edit4(name="Text#Color",
                                 default_value=[
                                     COLOR_List[1][0], COLOR_List[1][1],
                                     COLOR_List[1][2], COLOR_List[1][3]
                                 ],
                                 label="Text")
            core.add_color_edit4(name="ButtonActive#Color",
                                 default_value=[
                                     COLOR_List[2][0], COLOR_List[2][1],
                                     COLOR_List[2][2], COLOR_List[2][3]
                                 ],
                                 label="Button Active")
            core.add_color_edit4(name="BG#Color",
                                 default_value=[
                                     COLOR_List[3][0], COLOR_List[3][1],
                                     COLOR_List[3][2], COLOR_List[3][3]
                                 ],
                                 label="Background")
            core.add_color_edit4(name="Outline#Color",
                                 default_value=[
                                     COLOR_List[4][0], COLOR_List[4][1],
                                     COLOR_List[4][2], COLOR_List[4][3]
                                 ],
                                 label="Outline")
            core.add_separator()
            core.add_button("Test Colors", callback=test_colors)
            core.add_same_line()
            core.add_button("Reset", callback=reset_colors)
            core.add_button("Save Colors", callback=save_colors)
            core.add_spacing(count=2)
            core.add_separator()
            core.add_separator()
            core.add_spacing(count=2)
            scale = config_functions.get_scale()
            core.set_global_font_scale(scale)
            core.add_text("Change The Global Font Size")
            core.add_drag_float(
                "Global Scale",
                default_value=scale,
                format="%0.2f",
                speed=0.01,
                callback=lambda sender, data: core.set_global_font_scale(
                    core.get_value("Global Scale")))

            core.add_button("Reset##1", callback=reset_scale)
            core.add_button("Save Size##1", callback=save_scale)
            core.add_spacing(count=2)
            core.add_separator()
            core.add_separator()
            core.add_spacing(count=2)
            refresh = config_functions.get_refresh()
            refreshSymbol = config_functions.get_refresh_sign()
            core.add_text(
                "Change The refresh time for the Overlay ( in seconds )")
            core.add_input_int("##RefreshTime",
                               default_value=refresh,
                               min_value=5,
                               step=0)
            core.add_button("Save refresh time##1", callback=save_refresh_time)
            if refreshSymbol in "True":
                refreshSymbol = True
            else:
                refreshSymbol = False
            core.add_spacing(count=2)
            core.add_text("Enable, Disable the refresh sign in the overlay")
            core.add_checkbox("Refresh Symbol##RefreshTime",
                              default_value=refreshSymbol,
                              callback=refresh_symbol)
            core.add_separator()
            core.add_separator()
            core.add_button("Close##Color", callback=animation_config_color)

        core.add_spacing(count=3)
        core.add_image_button("##ConfigWeb",
                              value="resources/web.png",
                              callback=animation_config_web,
                              frame_padding=1,
                              tip="Web")
        core.add_spacing(count=2)
        core.add_image_button("##ConfigQuestion",
                              value="resources/q.png",
                              callback=animation_config_help,
                              frame_padding=1,
                              tip="Help")
        core.add_same_line(xoffset=50)

        with simple.group("##Web", show=False):
            web = webFunctions.get_web()
            web_parameters = webHandler.get_web_parameters()
            print(web_parameters)
            bgimage = ""
            core.add_text("Browser Settings")
            core.add_checkbox("Open in Browser Only##Browser",
                              default_value=web[0],
                              callback=lambda sender, data: save_web())
            core.add_same_line()
            core.add_checkbox("Open in Browser and App##Browser",
                              default_value=web[1],
                              callback=lambda sender, data: save_web())
            core.add_spacing(count=2)
            core.add_text("Text Size (pixel)")
            core.add_input_int("##BrowserTextSize",
                               default_value=web_parameters[0][0],
                               min_value=5,
                               step=0,
                               callback=save_font)
            core.add_text("Text Font:")
            core.add_combo("Font Family##Web",
                           items=WEB_FONT,
                           default_value=web_parameters[0][1],
                           callback=save_font)
            core.add_spacing(count=2)
            core.add_text(name="Background Image##Web",
                          default_value="Background Image")
            core.add_input_text("##BgImage",
                                default_value=web_parameters[0][2],
                                readonly=True)
            core.add_button("Search Background Image##Web",
                            callback=openFileDialog.get_background_image,
                            callback_data=bgimage)
            core.add_same_line()
            core.add_button(
                "Delete Background Image##Web",
                callback=lambda sender, data: core.set_value("##BgImage", ""))
            core.add_separator()
            core.add_separator()
            core.add_button("Close##Web", callback=animation_config_web)

        with simple.group("##Help", show=False):
            core.add_text("OUTDATED, WILL BE UPDATED IN THE NEXT RELEASE")
            core.add_input_text(
                "##HelpIntroText",
                multiline=True,
                readonly=True,
                height=110,
                width=340,
                default_value="Welcome to the help page of the Faceit Overlay\n"
                "here the options and different possibilities are\n"
                "explained to you.\n"
                "Here is a small overview;\n"
                "1: Start menu\n"
                "2: Color configuration\n"
                "3: Overlay")
            core.add_spacing(count=2)
            core.add_text("1: Start menu")
            core.add_image("##StartmenuImage",
                           value="resources/start_menu.png")
            core.add_input_text(
                "##HelpStartMenuText",
                multiline=True,
                height=70,
                width=340,
                readonly=True,
                default_value="The start menu is the configuration menu\n"
                "Here you can change colors, global size\n"
                "Enable / disable stats you want to see\n"
                "and start the Overlay")
            core.add_spacing(count=2)
            core.add_text("2: Color configuration")
            core.add_image("##ColorconfImage",
                           value="resources/color_config.png")
            core.add_input_text(
                "##HelpColorConfigText",
                multiline=True,
                height=220,
                width=340,
                readonly=True,
                default_value=
                "Here you can adjust the colors according to your own taste.\n"
                "The buttons have the following functions:\n\n"
                "Test Color: Sets the color for the menu so that you can check it.\n"
                "Reset Color: Sets the colors back to the default value.\n"
                "Save Color: Saves the colors so that they will be kept\n"
                "\t\t\t\t\t   on the next startup.\n\n"
                "To adjust the global size of the texts and heads you can move \n"
                "the slider to the left or right and then use the buttons \n"
                "to perform the following functions:\n\n"
                "Reset: Set the size back to 1.0\n"
                "Save Size: Save the global size for the next start up")
            core.add_spacing(count=2)
            core.add_text("3: Overlay")
            core.add_image("##OverlayImage", value="resources/overlay.png")
            core.add_input_text(
                "##HelpOverlayText",
                multiline=True,
                height=100,
                width=340,
                readonly=True,
                default_value=
                "The overlay has basically no functionalities except \n"
                "that it updates itself regularly (every 60 seconds) \n"
                "and thus adjusts the values.\n"
                "But if you click on the headers \n"
                "FACEIT STATS | LAST GAME  you get back to the start screen.\n"
            )
            core.add_button("Close##Help", callback=animation_config_help)
    """ ---------------------------------------------------------------------------------------------------------------
                                                START DPG 
        -------------------------------------------------------------------------------------------------------------"""
    core.enable_docking(dock_space=False)
    core.start_dearpygui(primary_window="FACEIT Elo Overlay")
Example #5
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()