Beispiel #1
0
    def initialize_base_screens(self):
        """
        Loads up input font and sets up development windows.
        """
        # font = list(Path("").absolute().parent.glob("**/InputMono-Black.ttf"))
        check_pipx = Path().home() / ".local/pipx/venvs/clockpuncher"
        if check_pipx.exists() is True:
            font = list(check_pipx.glob("**/fonts/InputMono-Black.ttf"))

            if font and font[0].exists():
                c.add_additional_font(file=str(font[0]), size=16)
        elif check_pipx.exists() is False:
            font = list(
                Path(__file__).resolve().parents[2].glob(
                    "**/fonts/InputMono-Black.ttf"))
            if font and font[0].exists():

                c.add_additional_font(str(font[0].absolute()), size=16)

        else:
            print("Cannot load font")
        c.set_main_window_title(self.title)
        c.set_main_window_size(*self.window_size)
        c.set_style_window_rounding(0)
        if self.development:
            c.set_main_window_pos(x=1120, y=0)
            start_development_windows(self.logger)

        else:
            c.set_main_window_resizable(False)
Beispiel #2
0
def set_styles():
    """
    Sets custom values for DearPy GUI window settings.
    """
    core.set_main_window_size(1500, 900)
    core.set_style_window_padding(8.00, 8.00)
    core.set_style_frame_padding(12.00, 4.00)
    core.set_style_item_spacing(8.00, 2.00)
    core.set_style_item_inner_spacing(2.00, 1.00)
    core.set_style_touch_extra_padding(0.00, 0.00)
    core.set_style_indent_spacing(12.00)
    core.set_style_scrollbar_size(16.00)
    core.set_style_grab_min_size(20.00)
    core.set_style_window_border_size(1.00)
    core.set_style_child_border_size(1.00)
    core.set_style_popup_border_size(0.00)
    core.set_style_frame_border_size(0.00)
    core.set_style_tab_border_size(0.00)
    core.set_style_window_rounding(4.00)
    core.set_style_child_rounding(4.00)
    core.set_style_frame_rounding(5.00)
    core.set_style_popup_rounding(4.00)
    core.set_style_scrollbar_rounding(5.00)
    core.set_style_grab_rounding(4.00)
    core.set_style_tab_rounding(5.00)
    core.set_style_window_title_align(0.50, 0.50)
    core.set_style_button_text_align(0.50, 0.50)
    core.set_style_selectable_text_align(0.00, 0.00)
    core.set_style_display_safe_area_padding(4.00, 4.00)
    core.set_style_global_alpha(1.00)
    core.set_style_antialiased_lines(True)
    core.set_style_antialiased_fill(True)
    core.set_style_curve_tessellation_tolerance(1.25)
    core.set_style_circle_segment_max_error(1.60)
    core.add_additional_font('Karla-Regular.ttf', 20)
Beispiel #3
0
def add_additional_font_uni(file='mylib/unifont-13.0.04.ttf', size=13):
    # https://github.com/hoffstadt/DearPyGui/issues/209#issuecomment-691930697
    add_additional_font(
        file,
        size,
        custom_glyph_ranges=(
            # the more ranges, the slower -> BAD METHOD!
            (0x3400, 0x4dbf),  # CJK Unified Ideographs Extension A
            (0x4E00, 0x9FFF
             ),  # CJK Unified Ideographs (Chinese chars, Han unification)
            (0x3040, 0x30ff),  # Japanese (Hiragana & Katakana)
            (0xac00, 0xd7a3),
            (0x1100, 0x11ff),
            (0x3131, 0x318e),
            (0xffa1, 0xffdc),  # Korean
            (0x0e00, 0x0e7f),  # Thai
            (0x370, 0x377),  # Greek and Coptic
            (0x400, 0x4ff),  # Cyrillic
            (0x530, 0x58f),  # Armenian
            (0x10a0, 0x10ff),  # Georgian
        ))
Beispiel #4
0
import dearpygui.core as core
import dearpygui.simple as simple
from logic import listen, load_config, modal, open_url, default

WINDOW = 'L0lScape Configuration'

with simple.window(WINDOW):
    core.set_main_window_title(WINDOW)
    core.set_main_window_size(430, 460)

    core.set_theme('Purple')

    core.set_style_item_spacing(5, 5)
    core.set_style_frame_padding(5, 5)

    core.add_additional_font('resources/monofur.ttf', 18)

    core.add_dummy(width=140)
    core.add_same_line()
    core.add_image('logo', 'resources/l0lscape.png')

    core.add_button('About', callback=modal, width=100)
    core.add_same_line()
    core.add_button('Github', callback=open_url, width=100)
    core.add_same_line()
    core.add_button('Discord', callback=open_url, width=100)
    core.add_same_line()
    core.add_button('Help', callback=open_url, width=100)

    core.add_separator()
Beispiel #5
0
        core.add_button("Choose template file",
                        callback=open_template_file,
                        width=200)
        core.add_same_line(spacing=10)
        core.add_input_text(
            "template_file",
            label="",
            width=300,
            enabled=False,
        )
        core.add_button("Choose output folder",
                        callback=open_output_folder,
                        width=200)
        core.add_same_line(spacing=10)
        core.add_input_text(
            "output_folder",
            label="",
            width=300,
            enabled=False,
        )
        core.add_same_line(spacing=10)
        core.add_input_text("Output file", width=100, default_value="out.docx")
        core.add_button("Start creation", callback=start_creation)

    Base.metadata.create_all(engine)
    core.add_additional_font("OpenSans-Regular.ttf", 25)
    core.set_theme("Light")
    core.set_main_window_title("Create Document from Template")
    core.set_main_window_pos(0, 0)
    core.start_dearpygui(primary_window="Create Document from Template")
Beispiel #6
0
"""."""

import os
from dearpygui import core, simple

# hardcoded to windows bs...
_fontpath = 'c:/windows/fonts'
_fontnames = []
_fonts = {}
for x in os.listdir(_fontpath):
    if x.endswith('otf') or x.endswith('ttf'):
        path = os.path.join(_fontpath, x)
        x = x[:-4]
        _fontnames.append(x)
        _fonts[x] = path
        core.add_additional_font(path)

_fontnames = sorted(_fontnames)


class ExampleFonts():
    def __init__(self):
        core.set_style_frame_padding(3, 3)
        core.set_style_window_padding(3, 3)
        core.set_main_window_size(650, 450)
        core.set_global_font_scale(1.5)
        with simple.window("main", autosize=True):
            with simple.group("panel", width=210):
                count = max(22, len(_fontnames))
                core.add_input_text("regex", label='', default_value=" ")
                core.add_listbox("font",
Beispiel #7
0

def multiple_accounts(sender, data):
    core.delete_item('Account Email')
    core.delete_item('Account Password')

    core.add_input_text('Accounts File',
                        default_value='accs_to_level.txt',
                        before='Login',
                        width=200)


with simple.window('Moon Overwatch Leveling Bot'):
    core.set_style_item_spacing(15, 15)
    core.set_style_frame_padding(5, 5)
    core.add_additional_font('Roboto-Regular.ttf', 14)

    core.add_image('logo', 'moon.png')
    core.add_separator()

    core.add_input_text('Account Email',
                        default_value='*****@*****.**',
                        width=200)

    core.add_input_text('Account Password',
                        default_value='weShouldBuffBrig!69',
                        width=200)

    core.add_checkbox('Multiple Accounts',
                      default_value=False,
                      callback=multiple_accounts)
Beispiel #8
0
def main():

    center_items = []
    core.add_data('item_center_list', center_items)

    with simple.window(TITLE):
        with simple.menu_bar('##menu_bar'):
            with simple.menu('File'):
                # core.add_menu_item('Import', callback=None)
                # core.add_menu_item('Export', callback=None)
                with simple.menu('Theme'):
                    themes = ['Dark', 'Light', 'Classic', 'Dark 2', 'Grey', 'Dark Grey', 'Cherry', 'Purple', 'Gold', 'Red']
                    for theme in themes:
                        core.add_menu_item(theme, callback=menu.update_theme)
                # core.add_menu_item('Exit', callback=None)
            with simple.menu('About'):
                core.add_menu_item('Version', callback=menu.show_version)

        with simple.group('##input_group'):
            # Title input
            core.add_text('Title:')
            core.add_input_text(TITLE_ID, hint='Enter title', width=WIDGET_WIDTH)
            core.add_spacing(count=2)

            # Identifier input
            core.add_text('Identifier:')
            core.add_input_text(IDENTIFIER_ID, hint='Enter identifier', width=WIDGET_WIDTH)
            core.add_spacing(count=2)

            # Password input
            core.add_text('Password:'******'Enter password', width=WIDGET_WIDTH)
            core.add_spacing(count=2)

            # Note input
            core.add_text('Note:')
            core.add_input_text(NOTE_ID, hint='Enter note info', width=WIDGET_WIDTH)
            core.add_spacing(count=10)

            # Save button
            save_clear_spacing = 50
            core.add_button('##save', label='Save', callback=input_field.save_password, width=WIDGET_HALF_WIDTH - (save_clear_spacing // 2))
            core.set_item_color('##save', core.mvGuiCol_Button, color=GREEN)
            core.add_same_line(spacing=save_clear_spacing)
            # Clear input entry button
            core.add_button('##clear_input', label='Clear input', callback=input_field.clear_input, width=WIDGET_HALF_WIDTH - (save_clear_spacing // 2))
            core.add_spacing(count=20)

        with simple.group('##log_group'):
            # Logger
            core.add_logger('##log_message', auto_scroll_button=False, copy_button=False, filter=False, clear_button=False, width=WIDGET_WIDTH, height=80)
            core.set_log_level(core.mvTRACE, logger='##log_message')
            core.add_spacing(count=10)

            # Clear log button
            core.add_button('##clear_log', label='Clear log', callback=logger.clear_log, width=WIDGET_WIDTH)
            core.add_spacing(count=10)

        with simple.group('##password_table_group'):
            # Password table
            header = ['No', 'Title', 'Identifier', 'Password', 'Note']
            core.add_table('##password_table', header, callback=table.table_printer, height=int(WINDOW_HEIGHT * 0.45), width=WIDGET_WIDTH)
            core.add_spacing(count=10)

            table.update_password_table()

            # Update password table button
            update_delete_spacing = 20
            core.add_button('##update_table', label='Update table', callback=table.update_password_table, width=WIDGET_HALF_WIDTH - (update_delete_spacing // 2))
            core.set_item_color('##update_table', core.mvGuiCol_Button, color=BLUE)
            core.add_same_line(spacing=update_delete_spacing)

            # Delete password table button
            core.add_button('##delete_table', label='Delete table', width=WIDGET_HALF_WIDTH - (update_delete_spacing // 2))
            core.set_item_color('##delete_table', core.mvGuiCol_Button, color=RED)
            with simple.popup('##delete_table', '##ask_delete', mousebutton=core.mvMouseButton_Left, modal=True):
                with simple.group('##delete_table_button_group'):
                    delete_table_spacing = 10
                    delete_table_half_width = core.get_main_window_size()[1] // 5 - delete_table_spacing

                    core.add_text('##delete_table_button', default_value='Are you sure to delete all data?')

                    core.add_spacing(count=delete_table_spacing)
                    core.add_button('##delete_table_button_yes', label='Yes', callback=table.delete_password_table, callback_data=True, width=delete_table_half_width)
                    core.add_same_line(spacing=delete_table_spacing)
                    core.add_button('##delete_table_button_no', label='No', callback=table.delete_password_table, callback_data=False, width=delete_table_half_width)

                    # TODO WONT WORK NEED TO FIX center_item FUNCTION
                    # center_item('##delete_table_button')
                    # center_item('##delete_table_button_yes')
                    # center_item('##delete_table_button_no')
                # center_item('##delete_table_button_group')

    if DEBUG_MODE:
        # core.show_logger()
        simple.show_debug()
        # simple.show_documentation()

    # Common Configuration
    core.set_theme(DEFAULT_THEME)
    core.add_additional_font(FONT, FONT_SIZE)
    core.set_main_window_title(TITLE)
    core.set_main_window_size(WINDOW_WIDTH, WINDOW_HEIGHT)
    core.set_main_window_resizable(RESIZABLE)
    core.set_style_window_padding(WINDOW_PADDING, WINDOW_PADDING)
    core.set_exit_callback(model.close_connection)

    # core.set_render_callback(apply_centering)
    core.start_dearpygui(primary_window=TITLE)
Beispiel #9
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")
                gg.set_item_callback(sender, remove_from_watchlist)

            def remove_from_watchlist(sender, data):
                self.user.remove_from_watchlist(ticker)
                set_item_label(sender, "Add To Watchlist")
                gg.set_item_callback(sender, add_to_watchlist)

            with group("footer", horizontal=True):
                with group("Buy Stock Group"):
                    def get_dynamic_cost(sender, data):
                        # TODO dynamic colouring
                        cost = round(gg.get_value("Quantity") * price, 2)
                        set_item_label("Stock volume", f"Total Cost: {cost}")

                    gg.add_input_float("Stock volume", default_value=0,
                                       width=100, source="Quantity", label="Total cost: 0",
                                       callback=get_dynamic_cost, on_enter=True)
                    gg.add_label_text("Message", label="", color=[255, 0, 0])
                    gg.add_button("Buy Shares", callback=purchase_stocks)
                with group("Stock Watchlist"):
                    if ticker not in self.user.watchlist:
                        gg.add_button("Watchlist Button", callback=add_to_watchlist, label="Add To Watchlist")
                    else:
                        gg.add_button("Watchlist Button", callback=remove_from_watchlist, label="Remove From Watchlist")


if __name__ == "__main__":
    gg.add_additional_font(f"{os.path.dirname(os.path.dirname(os.path.abspath(__file__)))}/arial.ttf")
    initial_screen()
    gg.start_dearpygui()
         2))  # TO CORRECT FOR SPACE BETWEEN COLUMNS
    minimum_left_padding = 50
    if left < minimum_left_padding:
        left = minimum_left_padding
    dpgs.set_item_width("left-spacer-tiles", left)


if __name__ == '__main__':

    # style settings
    dpg.set_main_window_size(1920, 1080)
    dpg.set_main_window_title("DearPy Gui Showcase")
    button_width = 500
    button_height = 300
    header_height = 100
    dpg.add_additional_font('resources/glacial_font.otf', 22)
    dpg.set_theme_item(0, 0, 0, 0, 255)  # set font colour
    dpg.set_theme_item(2, 255, 255, 255,
                       255)  # set background colour (mvGuiCol_WindowBg)

    # main window
    with dpgs.window('main window',
                     x_pos=0,
                     y_pos=0,
                     width=1600,
                     height=1200,
                     autosize=False,
                     no_resize=True,
                     no_title_bar=True,
                     no_move=True,
                     no_scrollbar=False,
Beispiel #12
0
    cursor.close()

except sqlite3.Error as error:
    print("Table exists", error)

finally:
    if (con):
        con.close()
        print("sqlite connection is closed")

wid = 800
hgt = 600
core.set_main_window_size(wid, hgt)

core.add_additional_font(
    "/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Bold.otf", 25, "")


def save_callback(sender, data):

    # Store Data to variables:
    tFN = core.get_value("##fname").strip()
    tSN = core.get_value("##sname").strip()
    tA1 = core.get_value("##add1").strip()
    tA2 = core.get_value("##add2").strip()
    tCI = core.get_value("##city").strip()
    tPC = core.get_value("##pcode").strip()
    tTE = core.get_value("##tel").strip()

    # Write to table:
    con = sqlite3.connect('addresses.db')