Ejemplo n.º 1
0
    def construct(self):
        core.set_main_window_title("Pathfinder")
        core.set_main_window_pos(0, 0)
        core.set_main_window_size(width=self.width, height=self.height)
        core.set_main_window_resizable(resizable=False)

        with simple.window("main_window"):
            core.add_group("main_panel", parent="main_window", horizontal=True)
            # MapDisplay ######################################################
            map_display = MapDisplay("map_display",
                                     parent="main_panel",
                                     tile_radius=1,
                                     latitude=47.4751158,
                                     longitude=19.0057389)
            map_display.construct()

            # InputPanel ######################################################
            core.add_group("user_panel", parent="main_panel", horizontal=False)
            input_panel = InputPanel("input_panel",
                                     parent="user_panel",
                                     map_display=map_display)
            input_panel.construct()

            execution_panel = ExecutionPanel("execution_panel",
                                             parent="user_panel",
                                             plotter=map_display)
            execution_panel.construct()
            core.end()  # user_panel

            ###################################################################
            core.end()  # main_panel
Ejemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser(
        description="Winsnap: Snap windows into a customizable grid")
    parser.add_argument("--debug",
                        action="store_true",
                        help="Show the log window")
    args = parser.parse_args()
    main_window = MainWindow()

    def mouse_click_cb(sender, data):
        main_window.refresh_windows()

    def startup_cb(sender, data):
        main_window.load()

    dpg_core.set_mouse_click_callback(mouse_click_cb)
    dpg_core.set_start_callback(startup_cb)
    dpg_core.set_resize_callback(main_window.resize_callback,
                                 handler="Main Window")
    scale = ctypes.windll.shcore.GetScaleFactorForDevice(0) / 100
    dpg_core.set_global_font_scale(scale)
    w, h = dpg_core.get_main_window_size()
    dpg_core.set_main_window_size(int(w * scale), int(h * scale))
    dpg_core.set_main_window_title("WinSnap")
    if args.debug:
        dpg_core.show_logger()
    dpg_core.start_dearpygui(primary_window="Main Window")
Ejemplo n.º 3
0
    def show(self):
        """Start the gui."""
        dpg.set_main_window_size(550, 550)
        dpg.set_main_window_resizable(False)
        dpg.set_main_window_title("Dearpygui Todo App")

        dpg.add_text("Todo App")
        dpg.add_text(
            "Add a todo by writing a title and clicking"
            " the add todo button",
            bullet=True)
        dpg.add_text("Toggle a todo by clicking on its table row", bullet=True)
        dpg.add_text(
            "Remove a todo by clicking on its table row and clicking"
            " the remove todo button",
            bullet=True)
        dpg.add_separator()

        dpg.add_spacing(count=10)
        dpg.add_input_text("New Todo Title", source="new-todo-title")
        dpg.add_button("Add todo", callback=self.__add_todo)
        dpg.add_spacing(count=10)
        dpg.add_separator()

        dpg.add_table('Todos', ['ID', 'Content', 'Done'],
                      height=200,
                      callback=self.__toggle_todo)
        dpg.add_separator()
        dpg.add_text("Selected todo:")
        dpg.add_button("Remove todo", callback=self.__remove_todo)
        dpg.add_button("Clear todos", callback=self.__clear_todos)

        # Render Callback and Start gui
        dpg.set_render_callback(self.__render)
        dpg.start_dearpygui()
Ejemplo n.º 4
0
    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",
                                 label='',
                                 items=_fontnames,
                                 num_items=count,
                                 width=210,
                                 callback=self.__changed)
            core.add_same_line()
            with simple.group("text"):
                core.add_text(
                    "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\
				Phasellus in mollis mauris. Donec tempor felis eget libero accumsan sagittis.\
				Integer efficitur urna sed nibh auctor, non hendrerit libero pulvinar.\
				Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere\
				cubilia curae; In hac habitasse platea dictumst. Vestibulum consectetur,\
				sem vitae tristique rhoncus, sem ex maximus ligula, vitae egestas lorem libero\
				nec libero. Pellentesque habitant morbi tristique senectus et netus et malesuada\
				fames ac turpis egestas. Praesent gravida laoreet pharetra. Ut nec vulputate purus.\
				Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos\
				himenaeos. Maecenas malesuada neque vel ipsum imperdiet, et lobortis justo sollicitudin.",
                    wrap=560)
        simple.show_style_editor()
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
    def make_gui(self):
        dpg.set_main_window_size(self.width, self.height)
        dpg.set_theme(self.theme)
        with simple.window("Main", no_title_bar=True):
            dpg.set_main_window_title("pytasker")
            with simple.menu_bar("Menu"):
                with simple.menu("File"):
                    dpg.add_menu_item("New Page", callback=self.new_tab)
                    dpg.add_menu_item("Load Page", callback=self.load_page)
                    dpg.add_menu_item("Save Page",
                                      callback=self.save_page_dialog)
                    dpg.add_separator()
                    dpg.add_menu_item("Quit", callback=self.exit_program)
                with simple.menu("Themes"):
                    dpg.add_menu_item("Dark", callback=self.theme_callback)
                    dpg.add_menu_item("Light", callback=self.theme_callback)
                    dpg.add_menu_item("Classic", callback=self.theme_callback)
                    dpg.add_menu_item("Dark 2", callback=self.theme_callback)
                    dpg.add_menu_item("Grey", callback=self.theme_callback)
                    dpg.add_menu_item("Dark Grey",
                                      callback=self.theme_callback)
                    dpg.add_menu_item("Cherry", callback=self.theme_callback)
                    dpg.add_menu_item("Purple", callback=self.theme_callback)
                    dpg.add_menu_item("Gold", callback=self.theme_callback)
                    dpg.add_menu_item("Red", callback=self.theme_callback)

            dpg.add_tab_bar(name="tab_bar_1", parent="Main")
            with simple.group("inittext"):
                dpg.add_text("Hello! Select File - New to get started")
Ejemplo n.º 7
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)
Ejemplo n.º 8
0
    def __init__(self):
        # tracks all the dpg mvKey_ constants
        self.__keymap = {}
        for const in dir(core):
            if const.startswith('mvKey_'):
                c = getattr(core, const)
                self.__keymap[c] = {'name': const, 'val': 0}

        core.set_main_window_size(750, 480)

        with simple.window("main"):
            with simple.group("press"):
                ...
            core.add_same_line()

            with simple.group("down"):
                ...
            core.add_same_line()

            with simple.group("release"):
                ...

        core.set_key_press_callback(self.__press)
        core.set_key_down_callback(self.__down)
        core.set_key_release_callback(self.__release)
        core.set_render_callback(lambda s, d: self.__render())
Ejemplo n.º 9
0
	def __init__(self):
		core.set_style_item_spacing(1, 1)
		core.set_style_window_padding(0, 0)
		core.set_main_window_size(690, 450)
		with simple.window("main"):
			core.add_drawing("canvas")
		core.set_resize_callback(self.__resize)
		core.set_render_callback(self.__render)
Ejemplo n.º 10
0
	def __init__(self):
		core.set_main_window_size(720, 540)
		with simple.window("main"):
			with simple.group("group"):
				core.add_button("thread", label='Add Thread', callback=lambda s, d: self.__buttonThread())

		self.__bars = {}
		core.set_render_callback(lambda s, d: self.__render())
		core.set_resize_callback(lambda s, d: self.__resize())
Ejemplo n.º 11
0
 def init_windows(self, external_exec_command=None):
     """
     Creates and arranges our windows for the kit
     """
     self._logger_window()
     self._command_window(exec_command=external_exec_command)
     c.add_debug_window("Debugger", x_pos=0, y_pos=350, width=500)
     c.end()
     c.set_main_window_size(1000, 850)
     c.set_main_window_pos(x=280, y=0)
Ejemplo n.º 12
0
    def __init__(self):
        self.__fontSize = 1.
        self.__fontSizeStep = .1
        self.__fontSizeRange = (.8, 15.)
        core.set_global_font_scale(self.__fontSize)
        core.set_theme("Cherry")
        core.set_main_window_size(960, 540)

        with simple.window("MainWindow", autosize=True):
            core.add_text("HELLO WORLD!")
        core.set_mouse_wheel_callback(self.__cbMouseWheel)
Ejemplo n.º 13
0
    def show(self):
        """Start the gui."""
        with sdpg.window("Main Window"):
            dpg.set_main_window_size(550, 600)
            dpg.set_main_window_resizable(False)
            dpg.set_main_window_title("Stockify")

            dpg.add_text("Stockify: The Future of Stocks")
            dpg.add_text(
                "Predict a stock by typing in its ticker and clicking"
                " the predict stock button",
                bullet=True,
            )
            dpg.add_text(
                "Remove a stock by clicking on its table row and clicking"
                " the remove stock button",
                bullet=True,
            )
            dpg.add_text(
                "All predictions will predict a stocks value "
                "in 30 days",
                bullet=True,
            )

            dpg.add_text(
                "Confidence is the degree that Stockify"
                " is sure about its prediction",
                bullet=True,
            )
            dpg.add_separator()

            dpg.add_spacing(count=10)
            dpg.add_input_text("Stock Ticker", source="stock-ticker")
            dpg.add_button("Predict Stock", callback=self.__add_stock)
            dpg.add_spacing(count=10)
            dpg.add_separator()

            dpg.add_table(
                "Stocks",
                ["Stock", "Prediction", "Confidence"],
                height=200,
                callback=self.__toggle_stock,
            )
            dpg.add_separator()
            dpg.add_text("Selected stock:")
            dpg.add_button("Remove stock", callback=self.__remove_stock)
            dpg.add_button("Clear stocks", callback=self.__clear_stocks)

            # Render Callback and Start gui
            dpg.set_render_callback(self.__render)
        dpg.start_dearpygui(primary_window="Main Window")
Ejemplo n.º 14
0
    def show(self):
        """Start the gui."""
        with sdpg.window("Main Window"):
            dpg.set_main_window_size(550, 650)
            dpg.set_main_window_resizable(False)
            dpg.add_spacing()
            dpg.set_main_window_title("Dearpygui File Zip")

            dpg.add_spacing()
            dpg.add_text("File Zip App")
            dpg.add_spacing()
            dpg.add_text("Select files to zip by adding them to the table",
                         bullet=True)
            dpg.add_text("Set the output directory", bullet=True)
            dpg.add_text("Click on the table to remove a file", bullet=True)
            dpg.add_text("Click on the zip files button to zip all the files",
                         bullet=True)
            dpg.add_text(
                "If you do not choose a directory, it will by default be"
                "the same directory from where you've run this script.",
                bullet=True)
            dpg.add_spacing()
            dpg.add_separator()

            dpg.add_spacing(count=10)
            dpg.add_button("Select output directory",
                           width=250,
                           callback=self.__select_output_directory)
            dpg.add_same_line()
            dpg.add_button("Add file", width=250, callback=self.__select_file)
            dpg.add_spacing(count=10)
            dpg.add_separator()

            dpg.add_text("Selected output directory:")
            dpg.add_table('Files', ['Path', 'Name'],
                          height=200,
                          callback=self.__remove_file)
            dpg.add_separator()
            dpg.add_progress_bar('Zip Progress', width=-1)
            dpg.add_separator()
            dpg.add_button("Clear files",
                           width=250,
                           callback=self.__clear_files)
            dpg.add_same_line()
            dpg.add_button("Zip Files", width=250, callback=self.__zip_files)
            dpg.add_spacing()
            dpg.add_label_text('##warnings')

            # Render Callback and Start gui
            dpg.set_render_callback(self.__render)
            dpg.start_dearpygui(primary_window="Main Window")
Ejemplo n.º 15
0
    def __init__(self):
        core.set_main_window_size(720, 540)
        self.__width = 17
        self.__height = 7
        self.__total = self.__width * self.__height
        self.__board = {}
        size = core.get_main_window_size()
        self.__paddle = [size[0] * .475, size[1] * .85]
        self.__paddleSize = (80, 8)
        # x, y, angle (rads), speed
        self.__radius = 6
        self.__speed = 300
        self.__paddleSpeed = 1000
        self.__speedMax = self.__speed * 3
        self.__pos = (size[0] * .5, size[1] * .8, 0, -self.__speed)

        with simple.window("main"):
            with simple.group("scoreboard"):
                core.add_label_text("score")
                core.add_same_line()
                core.add_text("score-value")
                # core.add_same_line()
                core.add_label_text("time")
                core.add_same_line()
                core.add_text("time-value")
            core.add_drawing("canvas", width=size[0], height=size[1])
            core.draw_circle("canvas",
                             size,
                             self.__radius, (255, 255, 255, 255),
                             fill=(128, 128, 128, 255),
                             tag="ball")
            core.draw_rectangle("canvas", [
                self.__paddle[0] - self.__paddleSize[0],
                self.__paddle[1] - self.__paddleSize[1]
            ], [
                self.__paddle[0] + self.__paddleSize[0],
                self.__paddle[1] + self.__paddleSize[1]
            ], (255, 255, 255, 255),
                                fill=(128, 128, 128, 255),
                                tag="paddle")

        core.set_resize_callback(self.__resize)
        core.set_render_callback(self.__render)
        core.set_key_down_callback(self.__keydown)
        core.set_mouse_wheel_callback(self.__mousewheel)
Ejemplo n.º 16
0
	def __init__(self):
		core.set_style_item_spacing(29, 4)
		core.set_style_window_padding(0, 0)
		core.set_main_window_size(1920, 1080)

		self.__column = 7
		self.__row = 58

		with simple.window("main"):
			with simple.group("test", width=187):
				core.add_button("THE DPG HERO WE NEED...", callback=self.__generate)

			for c in range(self.__column):
				core.add_same_line()
				with simple.group(f"col-{c}", width=187):
					x = c * self.__row
					for r in range(self.__row):
						core.add_text(str(x + r), default_value=" ")
Ejemplo n.º 17
0
    def _build(self):
        with simple.window(f"Object Pool: {self._title}", width=600, height=400, x_pos=0, y_pos=0, on_close=self.destroy, no_resize=False, no_close=True, no_move=True, no_collapse=True):
            core.add_label_text("Pools##total", label="Total Pools", default_value=str(len(self._pools)))
            core.add_label_text("Pools##memory", label="Memory Usage (MB)", default_value="0")
            core.add_label_text("Pools##cpu", label="System Load (%)", default_value="0")
            
            # show all pools
            for pool_name, pool in self._pools.items():
                with simple.collapsing_header(f"Pool: {pool_name}", default_open=False):
                    core.add_label_text(f"Objects_{pool_name}##total", label="Total Objects", default_value="0 / inf")
                    core.add_label_text(f"Objects_{pool_name}##subscribers", label="Subscriptions", default_value="0")
                    core.add_indent()
                    with simple.collapsing_header(f"Objects_{pool_name}##table", default_open=True):
                        pass
                    core.unindent()

        core.set_render_callback(self._render_callback)
        core.set_main_window_size(600, 400)
        core.set_main_window_title("Object Pool UI")
    def _create_primary_window(self) -> None:

        core.set_main_window_title('Swift Duplicate Images Finder')

        core.set_main_window_size(self._app_windows_size['width'] + 20,
                                  self._app_windows_size['height'] + 65)

        with simple.window(self._primary_window_name):

            core.configure_item(self._primary_window_name,
                                label='Duplicate Images Manager')

            core.add_menu_bar("MenuBar")

            core.add_menu("Actions")
            core.add_menu_item("Start new scan",
                               callback=self._new_scan_click_callback)
            core.add_menu_item("Quit", callback=self._quit_app_click_handler)
            core.end()

            core.add_menu("Themes")
            core.add_menu_item("Dark", callback=self._theme_callback)
            core.add_menu_item("Light", callback=self._theme_callback)
            core.add_menu_item("Classic", callback=self._theme_callback)
            core.add_menu_item("Dark 2", callback=self._theme_callback)
            core.add_menu_item("Grey", callback=self._theme_callback)
            core.add_menu_item("Dark Grey", callback=self._theme_callback)
            core.add_menu_item("Cherry", callback=self._theme_callback)
            core.add_menu_item("Purple", callback=self._theme_callback)
            core.add_menu_item("Gold", callback=self._theme_callback)
            core.add_menu_item("Red", callback=self._theme_callback)
            core.end()

            core.add_menu("Tools")
            core.add_menu_item("Show Logger", callback=core.show_logger)
            core.end()

            core.add_menu("About")
            core.add_menu_item("Visit source page",
                               callback=self._visit_source_page_click_callback)
            core.end()

            core.end()
Ejemplo n.º 19
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()
Ejemplo n.º 20
0
    def __init__(self):
        # row header names to preserve for re-posting table on searching
        self.__headers = []
        # the rows to filter during a search
        self.__rows = []

        cwd = os.path.dirname(__file__)
        os.chdir(cwd)

        core.set_main_window_size(800, 750)
        with simple.window("main"):

            with simple.group("control"):
                core.add_button("load",
                                callback=lambda: core.open_file_dialog(
                                    callback=self.__load, extensions='.csv'))
                core.add_input_text("filter",
                                    default_value=".*",
                                    callback=self.__tableRefresh)

            with simple.group("panel"):
                ...
Ejemplo n.º 21
0
    def start(self):
        available_out_ports = mido.get_output_names()
        available_in_ports = mido.get_input_names()

        if len(available_in_ports) > 0:
            status.current_in_port = mido.open_input(
                available_in_ports[0], callback=self.get_midi_input)

        if len(available_out_ports) > 0:
            self.out_port = mido.open_output(available_out_ports[0])

        core.set_main_window_size(350, 550)
        core.set_main_window_title('Fractal Melody Machine')
        core.set_theme('Gold')

        with simple.window('Fractal Melody Machine', width=500, height=300):
            core.add_text('MIDI Input Port')
            core.add_combo('ComboInPort', items=mido.get_input_names(
            ), default_value=status.current_in_port.name, label='', width=100, callback=self.change_midi_in_port)

            core.add_text('MIDI Output Port')
            core.add_combo('ComboOutPort', items=mido.get_output_names(
            ), default_value=self.out_port.name, label='', width=100, callback=self.change_midi_out_port)

            core.add_spacing(count=10)

            core.add_text('BPM')
            core.add_slider_int('SliderBPM', default_value=60, min_value=20, max_value=200, label='', width=100, callback=self.change_bpm)

            core.add_text('Depth')
            core.add_slider_int('SliderDepth', default_value=4, min_value=1,
                                max_value=16, label='', width=100, callback=self.change_depth)

            core.add_same_line(spacing=45)
            core.add_text('DetectedKey', default_value='Detected Key: ')

            core.add_text('Branching Factor')
            core.add_slider_int('SliderBF', default_value=2, min_value=2,
                                max_value=4, label='', width=100, callback=self.change_bf)

            core.add_text('Octave Spread')
            core.add_child('OctaveWindow', width=300, height=150)
            core.end()

            core.add_text('Figures')
            core.add_child('FigureWindow', width=300, height=150)

            core.add_table('FigureTable', [], hide_headers=True, height=10)

            core.add_columns('FigureTableCols', 2, border=False)

            core.add_checkbox(str(theory.FIGURE_WHOLE_NOTE), label='Whole note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_QUARTER_NOTE), label='Quarter note', callback=self.change_figures, default_value=True)
            core.add_checkbox(str(theory.FIGURE_16TH_NOTE), label='16th note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_64TH_NOTE), label='64th note', callback=self.change_figures)

            core.add_next_column()

            core.add_checkbox(str(theory.FIGURE_HALF_NOTE), label='Half note', callback=self.change_figures)
            core.add_checkbox(str(theory.FIGURE_8TH_NOTE), label='8th note', callback=self.change_figures, default_value=True)
            core.add_checkbox(str(theory.FIGURE_32ND_NOTE), label='32nd note', callback=self.change_figures)

            core.end()

            # Initialize octave spread sliders
            self.change_depth()

        core.start_dearpygui(primary_window='Fractal Melody Machine')
Ejemplo n.º 22
0
    def build(self):
        with simple.window("game_win", autosize=True):
            with simple.group("player"):
                left_label_text("Round: ",
                                "round",
                                default_value=str(self.round))
                left_label_text("Player: ",
                                "player",
                                default_value=self.player.name)
                left_label_text("Cash: ",
                                "cash",
                                default_value=str(self.player.cash))
                core.add_spacing(count=5)
                core.add_button("next_round",
                                label="Next round",
                                callback=self.next_round)

            core.add_spacing(count=5)
            core.add_separator()
            core.add_spacing(count=5)

            with simple.group("stocks"):
                # Titles
                core.add_text("Company")
                core.add_same_line(xoffset=stock_table_offsets[1])
                core.add_text("Price")
                core.add_same_line(xoffset=stock_table_offsets[2])
                core.add_text("Owned")
                core.add_same_line(xoffset=stock_table_offsets[3])
                core.add_text("Change")
                core.add_same_line(xoffset=stock_table_offsets[4])
                core.add_text("Old price")
                core.add_same_line(xoffset=stock_table_offsets[5])
                core.add_text("New price")
                core.add_same_line(xoffset=stock_table_offsets[6])
                core.add_text("Dividend")

                for stock in self.stocks:
                    core.add_text(stock.name)
                    core.add_same_line(xoffset=stock_table_offsets[1])
                    core.add_text(f"stock.{stock.name}.price",
                                  default_value=str(stock.price))
                    core.add_same_line(xoffset=stock_table_offsets[2])

                    # Buy / Sell functionality
                    core.add_input_int(
                        f"stock.{stock.name}.owned",
                        label="",
                        default_value=self.player.get_owned_stocks(stock),
                        max_value=int(self.player.cash / stock.price),
                        min_clamped=True,
                        max_clamped=True,
                        callback=self.buy_or_sell,
                        callback_data=[
                            stock,
                        ],
                        width=100,
                    )

                    core.add_same_line(xoffset=stock_table_offsets[3])
                    core.add_text(f"stock.{stock.name}.change",
                                  default_value=str(stock.change))
                    core.add_same_line(xoffset=stock_table_offsets[4])
                    core.add_text(
                        f"stock.{stock.name}.previous_price",
                        default_value=str(stock.previous_price),
                    )
                    core.add_same_line(xoffset=stock_table_offsets[5])
                    core.add_text(f"stock.{stock.name}.price2",
                                  default_value=str(stock.price))
                    core.add_same_line(xoffset=stock_table_offsets[6])
                    core.add_text(
                        f"stock.{stock.name}.dividend",
                        default_value=str(stock.dividend),
                    )

        core.set_main_window_title("Stock Trader")
        core.set_main_window_size(650, 450)
        core.set_main_window_resizable(False)
Ejemplo n.º 23
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()
Ejemplo n.º 24
0
from dearpygui import core, simple, demo

from convo.view import MainView
from convo import config

# Create windows
mm = MainView()
mm.draw()

# Default theme
core.set_theme(config.DEFAULT_THEME)

# demo.show_demo()

core.set_main_window_title('Convo-Craft')
core.set_main_window_size(*config.DEFAULT_WINDOW_SIZE)
core.start_dearpygui()
    # align body containing tiles
    item_width = dpgs.get_item_width('Demo 1')
    left = int(
        ((window_width - 1200 -
          ((space_between_columns - minimum_space_between_columns) / 2)) /
         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,
Ejemplo n.º 26
0
    core.add_text("Cannot Decrypt with plaintext", color=[255, 0, 0, 255], show=False)

# --parity bit drop table
keyp = [57, 49, 41, 33, 25, 17, 9, 
        1, 58, 50, 42, 34, 26, 18, 
        10, 2, 59, 51, 43, 35, 27, 
        19, 11, 3, 60, 52, 44, 36, 
        63, 55, 47, 39, 31, 23, 15, 
        7, 62, 54, 46, 38, 30, 22, 
        14, 6, 61, 53, 45, 37, 29, 
        21, 13, 5, 28, 20, 12, 4 ]

# Number of bit shifts 
shift_table = [1, 1, 2, 2, 
                2, 2, 2, 2, 
                1, 2, 2, 2, 
                2, 2, 2, 1 ]
  
# Key- Compression Table : Compression of key from 56 bits to 48 bits
key_comp = [14, 17, 11, 24, 1, 5, 
            3, 28, 15, 6, 21, 10, 
            23, 19, 12, 4, 26, 8, 
            16, 7, 27, 20, 13, 2, 
            41, 52, 31, 37, 47, 55, 
            30, 40, 51, 45, 33, 48, 
            44, 49, 39, 56, 34, 53, 
            46, 42, 50, 36, 29, 32 ]

core.set_main_window_size(1300, 430)
core.start_dearpygui()
Ejemplo n.º 27
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")
Ejemplo n.º 28
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)
Ejemplo n.º 29
0
    def __init__(self):

        self.__last = -1

        self.__targetFPS = 30

        # playhead position
        self.__head = 0.

        # playback stopped
        self.__direction = 0.

        # looping on
        self.__loop = True

        # thread that is "streaming" the video
        self.__thread = None

        self.__frameCount = self.__width = self.__height = 0

        self.__root = path.dirname(path.realpath(__file__))

        core.set_style_item_spacing(1, 1)
        core.set_style_frame_padding(0, 0)
        core.get_style_window_padding(0, 0)
        width = 740
        height = 680
        core.set_main_window_size(width, height)

        with simple.window("MainWindow"):
            core.add_drawing("Canvas", width=width, height=height)

        w = 50
        h = 20
        with simple.window("Media Bar",
                           autosize=True,
                           no_collapse=True,
                           no_close=True,
                           no_scrollbar=True):
            with simple.group("Browser"):
                core.add_listbox("Listing",
                                 label='',
                                 items=[],
                                 callback=self.__itemChange)

            with simple.group("Shuttle"):
                core.add_button("Shuttle#Browse",
                                width=w,
                                height=h,
                                label="...",
                                callback=lambda: core.select_directory_dialog(
                                    callback=self.__browser))
                core.add_button("Shuttle#Front",
                                width=w,
                                height=h,
                                label='|<',
                                callback=lambda: self.__seek(0))
                core.add_same_line()
                core.add_button("Shuttle#Backwards",
                                width=w,
                                height=h,
                                label='<-',
                                callback=lambda: self.__play(-1))
                core.add_same_line()
                core.add_button("Shuttle#Forwards",
                                width=w,
                                height=h,
                                label='->',
                                callback=lambda: self.__play(1))
                core.add_same_line()
                core.add_button("Shuttle#End",
                                width=w,
                                height=h,
                                label='>|',
                                callback=lambda: self.__seek(-1))
                core.add_same_line()
                core.add_color_button("Shuttle#Loop", [50, 50, 227, 255],
                                      width=w,
                                      height=h,
                                      callback=self.__loopToggle)
                core.add_same_line()
                core.add_text("ShuttleFPS")
                core.add_drag_float("MediabarHead",
                                    label="",
                                    width=w * 5 + 5,
                                    callback=self.__cbSeek)

        core.set_render_callback(self.__render)
        core.set_mouse_wheel_callback(self.__mouseWheel)
        core.set_exit_callback(self.__close)
        self.__scanDir()
Ejemplo n.º 30
0
 def set_size(width: int, height: int):
     dpgcore.set_main_window_size(width, height)