예제 #1
0
def setupconfig():
    dpg.set_main_window_size(600, 300)
    dpg.set_main_window_title("Sudoku Config")

    dpg.add_text(name="Sudoku Config")
    dpg.add_slider_int(name="Basesize",
                       default_value=c.basesize,
                       min_value=2,
                       max_value=5,
                       callback="updateconfig")
    dpg.add_slider_float(name="Delay in ms",
                         default_value=c.sleeptime * 1000,
                         min_value=0,
                         max_value=400,
                         callback="updateconfig")

    # dpg.add_button(name="Print Values",callback="butcallback")

    dpg.add_button(name="Start Solver", callback="startPygame")
    dpg.add_same_line()
    dpg.add_button(name="Stop Pygame", callback="stopSudoku")

    dpg.add_button(name="Reset Grid", callback="resetGrid")

    dpg.add_same_line()
    dpg.add_button(name="Set a Grid", callback="setGridone")
예제 #2
0
파일: logger.py 프로젝트: filipecn/maldives
 def init(self, parent):
     self.window_id = parent
     with dpg.group(horizontal=True, parent=self.window_id):
         dpg.add_checkbox(label="Auto-scroll",
                          default_value=True,
                          callback=lambda sender: self.auto_scroll(
                              dpg.get_value(sender)))
         dpg.add_same_line()
         dpg.add_button(label="Clear",
                        callback=lambda: dpg.delete_item(
                            self.filter_id, children_only=True))
         dpg.add_same_line()
         dpg.add_input_text(label="Filter",
                            callback=lambda sender: dpg.set_value(
                                self.filter_id, dpg.get_value(sender)))
     self.child_id = dpg.add_child(parent=self.window_id,
                                   autosize_x=True,
                                   autosize_y=True)
     self.filter_id = dpg.add_filter_set(parent=self.child_id)
예제 #3
0
def sma():
    with dpg.child(width=200, height=70):
        item = dpg.add_button(label='SMA')
        dpg.set_item_theme(dpg.last_item(), button_themes[5])
        dpg.add_same_line()
        i = dpg.add_input_int(default_value=3, label='', width=70)
        dpg.add_button(label='SMA200')
        dpg.set_item_theme(dpg.last_item(), button_themes[4])
        with dpg.tooltip(dpg.last_item()):
            dpg.add_text('Media Movel de 200 dias')
        with dpg.drag_payload(parent=dpg.last_item(),
                              drag_data=('SMA', 200),
                              payload_type='candle_plot'):
            dpg.add_text('SMA200')
        dpg.add_same_line()
        dpg.add_button(label='SMA50')
        dpg.set_item_theme(dpg.last_item(), button_themes[3])
        with dpg.drag_payload(parent=dpg.last_item(),
                              drag_data=('SMA', 50),
                              payload_type='candle_plot'):
            dpg.add_text('SMA50')
        dpg.add_same_line()
        dpg.add_button(label='SMA7')
        dpg.set_item_theme(dpg.last_item(), button_themes[2])
        with dpg.drag_payload(parent=dpg.last_item(),
                              drag_data=('SMA', 7),
                              payload_type='candle_plot'):
            dpg.add_text('SMA7')
    with dpg.drag_payload(parent=item,
                          drag_data=('SMA', dpg.get_value(i)),
                          payload_type='candle_plot'):
        dpg.add_text('SMA')
예제 #4
0
    def __init__(self):

        self.log_level = 0
        self._auto_scroll = True
        self.filter_id = None
        self.window_id = dpg.add_window(label="mvLogger", pos=(200, 200), width=500, height=500)
        self.count = 0
        self.flush_count = 1000
        self.level_options = {"Trace": 0, "Debug": 1, "Info": 2,  "Warning": 3, "Error": 4, "Critical": 5}

        with dpg.group(horizontal=True, parent=self.window_id):
            dpg.add_checkbox(label="Auto-scroll", default_value=True,
                             callback=lambda sender: self.auto_scroll(dpg.get_value(sender)))
            dpg.add_button(label="Clear", callback=lambda: dpg.delete_item(self.filter_id, children_only=True))
        dpg.add_input_text(label="Filter", callback=lambda sender: dpg.set_value(self.filter_id, dpg.get_value(sender)),
                           parent=self.window_id)
        dpg.add_radio_button(list(self.level_options.keys()), parent=self.window_id,
                             callback=lambda sender: self.set_level(self.level_options[dpg.get_value(sender)]))
        dpg.add_same_line(parent=self.window_id)
        self.child_id = dpg.add_child(parent=self.window_id, autosize_x=True, autosize_y=True)
        self.filter_id = dpg.add_filter_set(parent=self.child_id)

        with dpg.theme() as self.trace_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0, 255))

        with dpg.theme() as self.debug_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (64, 128, 255, 255))

        with dpg.theme() as self.info_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 255, 255))

        with dpg.theme() as self.warning_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 0, 255))

        with dpg.theme() as self.error_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

        with dpg.theme() as self.critical_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))
예제 #5
0
파일: main.py 프로젝트: filipecn/maldives
        # main
        with dpg.group(horizontal=True):
            with dpg.child(label='column_0', width=150, height=500):
                _candle_indicators()
            with dpg.child(label='column_1', width=700, height=500, payload_type='main_window',
                           drop_callback=_ticker_drop):
                window_data.main_window_title = dpg.add_text('Ticker: ')
                # dpg.add_button(label='Period')
                # with dpg.popup(dpg.last_item(), modal=True, mousebutton=dpg.mvMouseButton_Left) as modal_id:
                #     period_start = ''
                #     dpg.add_date_picker(level=dpg.mvDatePickerLevel_Day,
                #                         default_value={'month_day': 8, 'year': 93, 'month': 5},
                #                         callback=)
                #     dpg.add_button(label="OK", width=75, user_data=modal_id, callback=_period)
                dpg.add_radio_button(("1y", '6m', '1m', '1w', '1d'), callback=_period, horizontal=True)
                dpg.add_same_line()
                dpg.add_text(' on intervals of: ')
                dpg.add_same_line()
                dpg.add_radio_button(("15m", '30m', '1h', '1d'), callback=_interval, horizontal=True)

                # with dpg.menu(label='date'):
                #     dpg.add_time_picker(default_value={'hour': 14, 'min': 32, 'sec': 23})
                with dpg.plot(label="Candle Series", height=400, width=-1, drop_callback=_candle_plot_drop,
                              payload_type='candle_plot', no_title=True, anti_aliased=True) as window_data.candle_plot:
                    dpg.add_plot_legend()
                    window_data.candle_xaxis = dpg.add_plot_axis(dpg.mvXAxis, label="", time=True)
                    window_data.candle_yaxis = dpg.add_plot_axis(dpg.mvYAxis, label="BRL")
                with dpg.plot(label='volume_plot', height=300, width=-1, no_title=True, payload_type='volume_plot',
                              drop_callback=_volume_plot_drop, callback=_volume_plot_drop) as window_data.volume_plot:
                    dpg.add_plot_legend()
                    window_data.volume_xaxis = dpg.add_plot_axis(dpg.mvXAxis, label="", time=True)
예제 #6
0
 def __setup_add_widget__(self, dpg_args) -> None:
     dpgcore.add_same_line(name=self.id, **dpg_args)
예제 #7
0
    def __init__(self):

        self.bufferSize = 64 * 1024

        self.fileName = find_aes_file(
        )  # Set filnavnet af objektet til senere brug

        with dpg.window(no_resize=True) as self.mainWindow:
            # Laver hovedvindet med alle items
            dpg.add_same_line(spacing=45)
            dpg.add_text("Filnavn:")
            dpg.add_same_line(spacing=5)
            # Laver input textfelt, som selv ændrer WordSaver.filename
            dpg.add_input_text(label='.txt',
                               hint="Filename",
                               width=65,
                               callback=lambda sender: self.set_filename(
                                   dpg.get_value(sender)),
                               no_spaces=True,
                               default_value=self.fileName)
            dpg.add_spacing(count=5)
            dpg.add_same_line(spacing=75)
            dpg.add_button(label="Skriv", callback=self.toggle_write_window)
            dpg.add_same_line(spacing=10)
            dpg.add_button(label="Læs", callback=self.toggle_read_window)
            self.statusGood = dpg.add_text("",
                                           color=[0, 255, 0],
                                           show=False,
                                           pos=[10, 70])  # 2 status textfelter
            self.statusBad = dpg.add_text("",
                                          color=[255, 0, 0],
                                          show=False,
                                          pos=[10, 70])  # forskellige farver
            dpg.add_text("Text der skal krypteres:", pos=[40, 85])
            # Dette textfelt bruges til Input og Output til den krypterede fil
            self.rwfield = dpg.add_input_text(multiline=True,
                                              width=width - 50,
                                              height=90,
                                              pos=[15, 110],
                                              label='')
            dpg.add_button(label="Clear",
                           pos=[100, 203],
                           callback=lambda: dpg.set_value(self.rwfield, ""))

        with dpg.window(label="Skriv",
                        no_collapse=True,
                        show=False,
                        width=200,
                        height=20,
                        pos=[30, 10],
                        no_resize=True,
                        no_move=True) as self.writeWindow:
            # Skaber vinduet til at skrive til krypteringsfilen. Skjult som default.
            dpg.add_same_line(spacing=5)
            dpg.add_text("Kode:")
            dpg.add_same_line(spacing=10)
            # Adgangskodefelt. Kalder samme funktion som "Læs" knappen (show_read_text)
            self.writePW = dpg.add_input_text(password=True,
                                              hint="password",
                                              label="",
                                              on_enter=True,
                                              callback=self.write_text)
            dpg.add_spacing(count=3)
            dpg.add_same_line(spacing=70)
            dpg.add_button(label='Skriv',
                           height=30,
                           width=60,
                           callback=self.write_text)

        with dpg.window(label="Læs",
                        no_collapse=True,
                        show=False,
                        width=200,
                        height=20,
                        pos=[30, 10],
                        no_resize=True,
                        no_move=True) as self.readWindow:
            # Laver vinduet til at læse fra krypteringsfilen. Skjult som default
            dpg.add_same_line(spacing=5)
            dpg.add_text(f"Kode:")
            dpg.add_same_line(spacing=10)
            # Adgangskodefelt. Kalder samme funktion som "Læs" knappen (show_read_text)
            self.readPW = dpg.add_input_text(password=True,
                                             hint="password",
                                             label="",
                                             on_enter=True,
                                             callback=self.read_text)
            dpg.add_spacing(count=3)
            dpg.add_same_line(spacing=70)
            dpg.add_button(label='Læs',
                           height=30,
                           width=60,
                           callback=self.read_text)

        self.fileName = self.fileName + ".txt"  # Sætter rigtige filnavne med typer
        self.encryptetFileName = self.fileName + ".aes"  # .aes er krypteringstypen
예제 #8
0
파일: Daily.py 프로젝트: mugen8085/Bonus
    def __init__(self, parent=None):
        self.DataPath = None
        self.DataStartDate = None
        self.StartDate = None
        self.WindowPositionX = None
        self.WindowPositionY = None

        self.nBeginYear = 2019
        self.nBeginMonth = 1
        self.nBeginDay = 1
        self.nEndYear = 1970
        self.nEndMonth = 1
        self.nEndDay = 1

        self.LoadInitFile()

        self.ExecuteTime = time.localtime()
        # TimeStr = str(self.ExecuteTime.tm_year) + "-" + str(self.ExecuteTime.tm_mon).zfill(2) + "-" + str(self.ExecuteTime.tm_mday).zfill(
        #     2) + " " + str(self.ExecuteTime.tm_hour).zfill(2) + ":" + str(self.ExecuteTime.tm_min).zfill(2) + ":" + str(
        #     self.ExecuteTime.tm_sec).zfill(2)
        #================= UI =================.
        self.count = 0
        if parent:
            self.window_id = parent
        else:
            self.window_id = dpg.add_window(label="MyApp")
        # print(self.window_id)
        dpg.set_primary_window(self.window_id, True)
        # window_id = dpg.window(label="MyApp")

        if not dpg.is_viewport_created():
            vp = dpg.create_viewport(title="MyApp", width=430, height=750, x_pos=int(self.WindowPositionX), y_pos=int(self.WindowPositionY))
            dpg.setup_dearpygui(viewport=vp)
            dpg.show_viewport(vp)
            dpg.set_viewport_height(950)
            dpg.set_viewport_width(950)

        # self.slider_float = dpg.add_slider_float(label="float", parent=self.window_id, width=100)

        # self.ID_GetWinSize = dpg.add_button(parent=self.window_id, label="GetWinSize", callback=self.callback_getwinsize )
        # dpg.add_same_line(parent=self.window_id)
        dpg.add_text(parent=self.window_id, default_value="Time:")
        dpg.add_same_line(parent=self.window_id)
        self.ID_TimeText = dpg.add_button(parent=self.window_id, label="0", callback=self.callback_update_enddate)
        self.ID_BtnBeginDate = 0
        self.ID_BeginDate = None
        self.ID_BeginDatePicker= None
        self.ID_BeginYear = None
        self.ID_BeginMonth = None
        self.ID_BeginDay = None


        self.ID_BtnEndDate = 0
        self.ID_EndDate = None
        self.ID_EndDatePicker = None
        self.ID_EndYear = None
        self.ID_EndMonth = None
        self.ID_EndDay = None

        self.ShowInfo()
        self.UIBeginDate()
        self.UIEndDate()

        # dpg.add_same_line(parent=self.window_id)
        # self.ID_BeginDate = dpg.add_button(label="BeginDate", parent=self.window_id, callback=self.callback_begindate)
        self.BeginDate = datetime.strptime(self.StartDate, "%Y-%m-%d")
        self.EndDate = datetime.today()
        self.Stock = StockTool(self.DataPath, self.BeginDate, self.EndDate)

        self.ID_BtnDownloadData = dpg.add_button(parent=self.window_id, label="Download", callback=self.callback_downloaddata)
예제 #9
0
파일: Daily.py 프로젝트: mugen8085/Bonus
 def UIEndDate(self):
     # dpg.add_text("EndDate(yyyy/mm/dd):  ", parent=self.window_id )
     # 取得當前時間.
     self.ID_BtnEndDate = dpg.add_button(parent=self.window_id, label="EndDate  (yyyy/mm/dd):", callback=self.callback_enddate)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("   ", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_EndYear = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=40, callback=self.callback_inputtext)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("/", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_EndMonth = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=20, callback=self.callback_inputtext)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("/", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_EndDay = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=20, callback=self.callback_inputtext)
     dpg.set_value(self.ID_EndYear, self.ExecuteTime.tm_year)
     dpg.set_value(self.ID_EndMonth, self.ExecuteTime.tm_mon)
     dpg.set_value(self.ID_EndDay, self.ExecuteTime.tm_mday)
예제 #10
0
파일: Daily.py 프로젝트: mugen8085/Bonus
 def UIBeginDate(self):
     # dpg.add_text("BeginDate(yyyy/mm/dd):", parent=self.window_id )
     self.ID_BtnBeginDate = dpg.add_button(parent=self.window_id, label="BeginDate(yyyy/mm/dd):", callback=self.callback_begindate)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("   ", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_BeginYear = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=40, callback=self.callback_inputtext)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("/", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_BeginMonth = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=20, callback=self.callback_inputtext)
     dpg.add_same_line(parent=self.window_id)
     dpg.add_text("/", parent=self.window_id)
     dpg.add_same_line(parent=self.window_id)
     self.ID_BeginDay = dpg.add_input_text(parent=self.window_id, label="", decimal=True, width=20, callback=self.callback_inputtext)
     dpg.set_value(self.ID_BeginYear, self.nBeginYear)
     dpg.set_value(self.ID_BeginMonth, self.nBeginMonth)
     dpg.set_value(self.ID_BeginDay, self.nBeginDay)