示例#1
0
文件: widgets.py 项目: zakx/bimpy
            bimpy.separator()
            bimpy.text("Some text")
            bimpy.next_column()
            bimpy.text("Some text")
            bimpy.next_column()
            bimpy.text("Some text")
            bimpy.next_column()
            bimpy.text("Some text")
            bimpy.separator()
            bimpy.columns(1)

            if bimpy.button("Some button"):
                a = 0
                print("!!!")

            bimpy.progress_bar(a)

            bimpy.combo("Combo!", selectedItem, mylist)

            bimpy.push_item_width(-10.0)
            bimpy.plot_lines("Some plot", vals, graph_size=bimpy.Vec2(0, 300))
            bimpy.pop_item_width()

            a += 0.01
        bimpy.end()

        if bimpy.begin("Hello2!",
                       flags=(bimpy.WindowFlags.AlwaysAutoResize
                              | bimpy.WindowFlags.NoTitleBar)):
            bimpy.text("Some text")
示例#2
0
largeur_cible = bimpy.Int(150)

while not ctx.should_close():
    ctx.new_frame()

    bimpy.set_next_window_pos(bimpy.Vec2(0, 0), bimpy.Condition.Once)
    bimpy.set_next_window_size(bimpy.Vec2(800, 400), bimpy.Condition.Once)
    bimpy.begin("Controls")

    bimpy.input_text("Nom du fichier", nom, 15)

    if bimpy.button("Visualisation"):
        while (i < 1000000):
            num = i / 1000000
            bimpy.progress_bar(num)
            bimpy.end()
            ctx.render()
            i = i + 1
    if bimpy.button("Debut du Scan"):
        a = 2
    if bimpy.button("Visualisation du resultat"):
        a = 3
    bimpy.text("Choix des formats de sortie")

    bimpy.checkbox("VTK", vtk)

    bimpy.checkbox("STL", stl)

    bimpy.checkbox("OBJ", obj)
    def render(self, ctx, windows_info):

        pos = bimpy.Vec2(conf.margin, conf.margin)
        size_min = bimpy.Vec2(conf.min_file_browser_width,
                              ctx.height() - 2 * conf.margin)
        size_max = bimpy.Vec2(conf.max_file_browser_width,
                              ctx.height() - 2 * conf.margin)

        bimpy.set_next_window_pos(pos, bimpy.Condition.Once)
        bimpy.set_next_window_size_constraints(size_min, size_max)

        bimpy.begin(LANG.file_brewswer_ui_title, bimpy.Bool(True),
                    bimpy.WindowFlags.NoCollapse | bimpy.WindowFlags.NoMove)

        ###########UI###########
        if bimpy.button(LANG.file_brewswer_ui_refresh) == True:
            self.fb.refresh_file_list()

        bimpy.same_line()
        if bimpy.button(LANG.about) == True:
            bimpy.open_popup(LANG.about)

        # call render about ui
        # print(dir(windows_info['about_ui']))
        windows_info['about_ui']['self'].about()

        for idx, f_name in enumerate(self.fb.file_list):
            # print(self.selected.value)
            if bimpy.selectable(
                    f_name.split('\\')[-1], self.selected.value == idx):
                self.selected.value = idx

                if self.selected.value != -1 and self.selected.value != self.preidx:
                    self.preidx = self.selected.value
                    windows_info['image_shower_ui']['self'].update_pic(f_name)
                    windows_info['meta_info_ui']['self'].update_meta_info(
                        f_name)

        # progress bar
        if not self.fb.q.empty():
            self.process = self.fb.q.get()

            f, d = self.process[-2], self.process[-1]
            # update if new
            if d != {}:
                self.fb.pp.yolo_res[f] = d

            self.process = (self.process[0] + 1, self.process[1])

            if self.process[0] == self.process[1]:
                with open('yolo_res', 'wb') as f:
                    pickle.dump(self.fb.pp.yolo_res, f)

                # build retrieval index
                windows_info['retrival_ui']['self'].init = False

        sz = bimpy.get_window_size()
        bimpy.set_cursor_pos(bimpy.Vec2(conf.margin, sz.y - conf.margin * 2))
        bimpy.push_item_width(sz.x - conf.margin * 3 - 60)

        process = self.process
        bimpy.progress_bar(process[0] / float(process[1]),
                           bimpy.Vec2(0.0, 0.0),
                           "{}/{}".format(process[0], process[1]))

        bimpy.same_line()
        if bimpy.button(LANG.reindex) == True and process[0] == process[1]:
            self.fb.refresh()

        ########################

        t = {
            'x': bimpy.get_window_pos().x,
            'y': bimpy.get_window_pos().y,
            'w': bimpy.get_window_size().x,
            'h': bimpy.get_window_size().y,
            'self': self,
        }

        bimpy.end()

        return t
示例#4
0
                    b_col_count.value = COL_COUNT
                refresh = False
            bimpy_imgdict[url] = bimpy.Image(
                img.resize((64, 64), Image.ANTIALIAS))
            q.task_done()

        if img_urls:
            bimpy.set_next_window_pos(bimpy.Vec2(625, 20),
                                      bimpy.Condition.Once)
            bimpy.set_next_window_size(bimpy.Vec2(532, 600),
                                       bimpy.Condition.Once)
            bimpy.begin('Collage', bimpy.Bool(True),
                        bimpy.WindowFlags.HorizontalScrollbar)
            if imgs_downloading:
                bimpy.text("Downloading thumbnails")
                bimpy.progress_bar(percent_downloaded, bimpy.Vec2(-1, 0),
                                   f"{imgs_downloaded}/{imgs_total}")
            else:
                bimpy.text("Collage columns")
                bimpy.same_line()
                bimpy.slider_int("", b_col_count, 1, len(img_urls))

            if not imgs_downloading and bimpy.button("Save Collage"):
                # print(data)
                saved = save_collage(current_playlist_id, img_urls, imgdict,
                                     program_start_dir, b_col_count.value)
                saved_time = time.clock()
                print("saved:", saved)

            if time.clock() - saved_time <= 2:
                bimpy.same_line()
                bimpy.text(f"Saved to {saved}.png")