コード例 #1
0
    def __distance_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(5, 120 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Distance",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Distance Traveled")
        bimpy.pop_font()
        bimpy.separator()

        if self.data.distance <= 1.1:
            distance_formatted_data = str(int(self.data.distance * 1000))
            distance_formatted_data = distance_formatted_data.rjust(4, "0")
            scalar = "m"
        else:
            distance_formatted_data = "{:.2f}".format(self.data.distance)
            distance_formatted_data = distance_formatted_data.rjust(6, "0")
            scalar = "Km"

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(38, -1)
        bimpy.text(distance_formatted_data)
        bimpy.same_line(245, 0)
        bimpy.text(scalar)
        bimpy.pop_font()

        bimpy.end()
コード例 #2
0
    def __voltage_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(5, 278 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Voltage",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Voltage")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        if self.data.voltage >= 0:
            bimpy.text("{:.2f}".format(self.data.voltage).rjust(6, "0"))
        else:
            bimpy.text("-" + "{:.2f}".format(self.data.voltage).rjust(5, "0"))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(220, 0)
        bimpy.text("Volt")
        bimpy.pop_font()

        bimpy.end()
コード例 #3
0
    def __current_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(5, 393 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Current",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Current")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        bimpy.text("{:.2f}".format(self.data.voltage).rjust(6, "0"))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(215, 0)
        bimpy.text("Amp")
        bimpy.pop_font()

        bimpy.end()
コード例 #4
0
    def __speed_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(355, 120 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Speed",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Speed")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        bimpy.text(str(int(self.data.speed[0])).rjust(4, " "))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(200, 0)
        bimpy.text("Km/H")
        bimpy.pop_font()

        bimpy.end()
コード例 #5
0
    def __rpm_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(705, 278 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(305, 225), bimpy.Condition.Once)

        bimpy.begin("RPM",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "RPM")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        bimpy.text(str(int(self.data.rpm)).rjust(4, "0"))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(175, 0)
        bimpy.text("RPM")
        bimpy.pop_font()

        self.rpm_datas.append(self.data.rpm)
        self.rpm_datas.pop(0)

        self.rpm_datas.reverse()
        bimpy.plot_lines("", self.rpm_datas, graph_size=bimpy.Vec2(288, 112))
        self.rpm_datas.reverse()
        bimpy.end()
コード例 #6
0
    def __calories_burtn_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(355, 5 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Calories Burnt",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Calories Burnt")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        if self.data.calories_burned >= 0:
            bimpy.text("{:.2f}".format(self.data.calories_burned).rjust(
                7, "0"))
        else:
            bimpy.text("0.00".rjust(7, "0"))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(250, 0)
        bimpy.text("cal")
        bimpy.pop_font()

        bimpy.end()
コード例 #7
0
ファイル: app.py プロジェクト: gfannes/subsoil
 def run(self):
     ctx = bimpy.Context()
     ctx.init(600, 600, "Neural Network")
     while (not ctx.should_close()):
         with ctx:
             bimpy.begin("Control Center")
             self.sub.show(ctx)
             bimpy.end()
コード例 #8
0
def main():
	global CTX

	ctx = bimpy.Context()
	ctx.init(1200, 1200, "Image")
	with ctx:
		bimpy.themes.set_light_theme()


	socket_thread = threading.Thread(target = thread_socket_func, args = (8883, ))
	socket_thread.start()

	message_thread = threading.Thread(target = message_thread_func)
	message_thread.start()

	previous_n_points = 0
	clear_flag = False
	while not ctx.should_close():
		with ctx:
			bimpy.set_next_window_pos(bimpy.Vec2(120, 120), bimpy.Condition.Once)
			bimpy.set_next_window_size(bimpy.Vec2(400, 400), bimpy.Condition.Once)
			bimpy.begin("Window #1")
			
			bimpy.text("This is text!")
			
			if bimpy.button("Send A Lot Of Messages"):
				temp_messages = [make_message_text("log", "Message #" + str(i)) for i in range(560)]
				send_messages(CTX.message_pipeline, temp_messages)
			
			if bimpy.button("Send A Lot Of Random Points"):
				temp_messages = [make_message_point("point", (random.randrange(400 + i), random.randrange(400 + i))) for i in range(20)]
				send_messages(CTX.message_pipeline, temp_messages)				
			
			if bimpy.button("Clear Flag"):
				clear_flag = not clear_flag
			
			bimpy.text("Text from events:\n%s" % (CTX.data.text))

			bimpy.end()

			draw_window_drawing(ctx, 400, 400, "Sample Drawing", CTX.data.points)

	log("Exited rendering thread")

	log("Sending exit to message_thread")
	send_message_text(CTX.message_pipeline, "exit", "")

	log("Waiting for message_thread")
	message_thread.join()
	CTX.server_socket_running = False
	if CTX.server_socket:
		for c, info in CTX.server_socket.connections:
			c.send(b'exit')

	log("Waiting for socket_thread")
	socket_thread.join()

	log("Bye")
コード例 #9
0
ファイル: utils.py プロジェクト: torss/bimpy
def begin_root(name="root", menu=False):
    bp.set_next_window_pos(bp.Vec2(0, 0))
    bp.set_next_window_size(bp.io.display_size)
    bp.push_style_var(bp.Style.WindowRounding, 0)
    flags = bp.WindowFlags.NoDecoration | bp.WindowFlags.NoMove
    if menu:
        flags = flags | bp.WindowFlags.MenuBar
    bp.begin("name", flags=flags)
    bp.pop_style_var()
コード例 #10
0
def view_batch(bp):
    bimpy.begin("Batch")
    bimpy.button("Open files...")
    bimpy.button("Open configurations...")
    bimpy.separator()
    bimpy.text("Regions:")
    bimpy.separator()
    bimpy.button("Render Files")
    bimpy.end()
コード例 #11
0
    def __separator_name_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(5, 90), bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(1005, 38), bimpy.Condition.Once)

        bimpy.begin("Separator Name",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))
        bimpy.separator()
        bimpy.text("")
        bimpy.separator()
        bimpy.end()
コード例 #12
0
    def visualize(self):
        bimpy.begin(type(self).__name__ + " - " + str(id(self)), bimpy.Bool(True))
        bimpy.input_text("Text", self.__state["text"], 256)

        button_pressed = bimpy.button("Plot", bimpy.Vec2(40, 20))

        if button_pressed or self.__state["toggle"]:
            if button_pressed:
                self.__state["toggle"] ^= True
            if len(self.__state["text"].value) > 0:
                bimpy.plot_lines("Graph", self.encode(self.__state["text"].value.encode()))
        bimpy.end()
コード例 #13
0
ファイル: main.py プロジェクト: vladsterz/build_tools_manager
def main():
    selected_compiler = bimpy.Int()
    ctx = bimpy.Context()
    ctx.init(WIDTH, HEIGHT, "Virtual enviroment manager")

    environments = getAvailableEnviroments()
    compilers_list = list(data.compilers.keys())

    show_new_env_menu = False

    while (not ctx.should_close()):
        with ctx:
            bimpy.set_next_window_pos(bimpy.Vec2(0, 0), bimpy.Condition.Once)
            bimpy.set_next_window_size(bimpy.Vec2(WIDTH, HEIGHT),
                                       bimpy.Condition.Once)
            bimpy.begin("Enviroments",bimpy.Bool(True), \
                bimpy.WindowFlags.NoCollapse and bimpy.WindowFlags.NoResize)
            bimpy.text(sys.version)
            bimpy.columns(2)
            for enviroment in environments:
                if bimpy.button(enviroment):
                    compiler = list(data.compilers.values())[
                        selected_compiler.
                        value] if selected_compiler.value != 0 else ""
                    subprocess.call(
                        ['start', environments[enviroment], compiler],
                        shell=True)
                bimpy.next_column()
                if bimpy.button("O##" + enviroment):
                    subprocess.Popen(r'explorer /select,' +
                                     os.path.dirname(environments[enviroment]))
                    #os.startfile(os.path.realpath(os.path.dirname(environments[enviroment])))
                bimpy.next_column()
            bimpy.columns(1)
            if bimpy.combo("Compiler", selected_compiler, compilers_list):
                pass

            # if bimpy.button("Add new enviroment"):
            #     new_env_ctx = BimpyContext(WIDTH, HEIGHT, "New enviroment menu")
            #     while(not new_env_ctx.ctx.should_close()):
            #         with new_env_ctx.ctx:
            #             bimpy.begin("dsad")
            #             bimpy.text("d")
            #             bimpy.end()

            # if bimpy.button("Create new enviroment"):

            bimpy.end()
コード例 #14
0
    def __heart_rate_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(705, 5 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(305, 225), bimpy.Condition.Once)

        bimpy.begin("Heart Rate",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Heart Rate")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.text("")

        bimpy.same_line(30, -1)

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text(str(int(self.data.heart_rate)).rjust(3, "0"))
        bimpy.pop_font()

        bimpy.same_line(140, 20)

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("BPM")
        bimpy.pop_font()

        if (time.time() -
                self.heart_rate_start_monitor) >= (self.data.heart_rate / 60):
            self.heart_rate_data.append(-0.7)
            self.heart_rate_data.append(1)
            self.heart_rate_start_monitor = time.time()
            self.heart_rate_data.pop(0)
        else:
            self.heart_rate_data.append(0)

        self.heart_rate_data.pop(0)

        self.heart_rate_data.reverse()
        bimpy.plot_lines("",
                         self.heart_rate_data,
                         graph_size=bimpy.Vec2(288, 112),
                         scale_min=-1.0,
                         scale_max=1.3)
        self.heart_rate_data.reverse()

        bimpy.end()
コード例 #15
0
ファイル: frames.py プロジェクト: RatchetModding/slimseditor
    def render(self):
        super(SaveGameFrame, self).render()
        if bimpy.begin(self.name,
                       self.opened,
                       flags=bimpy.WindowFlags.NoCollapse
                       | bimpy.WindowFlags.MenuBar):

            if bimpy.begin_menu_bar():
                bimpy.menu_item('Save', 'Cmd+S', self.click_states['save'])
                bimpy.menu_item('Reload', 'Cmd+R', self.click_states['reload'])
                bimpy.menu_item('Export', 'Cmd+E', self.click_states['export'])
                bimpy.menu_item('Reload & Diff', 'Cmd+D',
                                self.click_states['reload_and_diff'])
                bimpy.end_menu_bar()

            if self.diff_string:
                bimpy.columns(2, "hex split")

            bimpy.text('Game: ')
            bimpy.same_line()
            bimpy.text(self.backend.game.value)

            for section_name, section_items in self.items.items():
                if bimpy.collapsing_header(section_name):
                    for item in section_items:
                        item.render_widget()

            if self.diff_string:
                bimpy.next_column()
                for line in self.diff_string.splitlines():
                    bimpy.text(line)

            bimpy.end()
コード例 #16
0
ファイル: test.py プロジェクト: podgorskiy/getoolkit
    def on_update(self):
        y = 30
        self.text('Window size: %dx%d' % (self.width, self.height), 10, y)
        y += 30
        self.text('World size: %dx%d' % (self.world_width, self.world_height),
                  10, y)
        y += 30
        self.text('Scale %f' % self.scale, 10, y)
        y += 30
        self.text('%f x %f' % self.cursor_pos_world, 10, y)
        y += 30

        self.point(*self.cursor_pos_world, (230, 10, 10, 240), radius=2.)

        plt = vec2(-0.035, -0.045)
        pmt = vec2(0.56, 0.31)
        prt = vec2(0.862, 0.0421)
        plm = vec2(0.039, -0.3)
        prm = vec2(0.87, -0.088)
        plb = vec2(0.31, -0.35)
        pmb = vec2(0.55, -0.35)
        prb = vec2(0.84, -0.25)

        self._ctx.nvgBeginPath()
        self._ctx.nvgScale(vec2(1000.))
        self._ctx.nvgTranslate(vec2(1.))
        self._ctx.nvgScale(vec2(1., -1.))

        self._ctx.nvgMoveTo(plt)
        self._ctx.nvgQuadTo(plm, plb)
        self._ctx.nvgQuadTo(pmb, prb)
        self._ctx.nvgQuadTo(prm, prt)
        self._ctx.nvgQuadTo(pmt, plt)
        self._ctx.nvgClosePath()
        self._ctx.nvgFillColor(vec4(0.73, 0.78, 0.83, 1.))
        self._ctx.nvgFill()

        bimpy.begin('Editor')
        bimpy.columns(2)
        bimpy.begin_child('Scene', bimpy.Vec2(0, 300))
        self.scene_tree()
        bimpy.end_child()
        bimpy.next_column()
        self.object_inspector()
        self.draw()
        bimpy.end()
コード例 #17
0
    def render(self, config_server):
        if self.ctx.should_close():
            return 0

        self.ctx.new_frame()
        bimpy.set_next_window_pos(bimpy.Vec2(0, 0), bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(self.width, self.height),
                                   bimpy.Condition.Once)
        bimpy.begin("",
                    flags=bimpy.WindowFlags.NoResize
                    | bimpy.WindowFlags.NoTitleBar | bimpy.WindowFlags.NoMove)

        self.draw_gui(config_server)

        bimpy.end()
        self.ctx.render()

        return 1
コード例 #18
0
    def __gender_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(729, 5), bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(166, 80), bimpy.Condition.Once)

        bimpy.begin("Gender",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Gender")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[16]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(38, 0)
        bimpy.text("Female" if self.data.gender else "Male")
        bimpy.pop_font()

        bimpy.end()
コード例 #19
0
def draw_window_drawing(ctx, w, h, name, points):

	bimpy.set_next_window_pos(bimpy.Vec2(w + 20, h + 20), bimpy.Condition.Once)
	bimpy.set_next_window_size(bimpy.Vec2(w, h), bimpy.Condition.Once)
	bimpy.begin(name)
	
	window_zero = bimpy.get_window_pos() + bimpy.Vec2(100 + temp_separation_test.value, 100 + temp_separation_test.value)
	window_one = bimpy.get_window_pos() + bimpy.Vec2(w - 100 - temp_separation_test.value, h - 100 - temp_separation_test.value)
	
	bimpy.add_circle_filled(window_zero, 5.0, 0xFF000000 + 0xc88200, 100)
	bimpy.add_circle_filled(window_one, 5.0, 0xFF000000 + 0x4bb43c, 100)

	for x,y in points:
		point = bimpy.get_window_pos() + bimpy.Vec2(x, y)
		bimpy.add_circle_filled(point, 5.0, 0xFF000000 + 0x4bb43c, 100)


	bimpy.slider_float("separation", temp_separation_test, 0.0, 100.0)

	bimpy.end()
コード例 #20
0
    def __age_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(900, 5), bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(110, 80), bimpy.Condition.Once)

        bimpy.begin("Age",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Age")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[16]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(38, 0)
        bimpy.text(str(self.data.age))
        bimpy.pop_font()

        bimpy.end()
コード例 #21
0
    def __time_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(5, 5 + 128), bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 110), bimpy.Condition.Once)

        bimpy.begin("Time Elapsed",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Time Elapsed")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(38, 0)
        bimpy.text(
            str(datetime.timedelta(seconds=self.data.exercize_time))[:-4])
        bimpy.pop_font()

        bimpy.end()
コード例 #22
0
    def __power_window(self):
        bimpy.set_next_window_pos(bimpy.Vec2(355, 278 + 128),
                                  bimpy.Condition.Once)
        bimpy.set_next_window_size(bimpy.Vec2(345, 225), bimpy.Condition.Once)

        bimpy.begin("Power",
                    flags=bimpy.WindowFlags(4) | bimpy.WindowFlags(1)
                    | bimpy.WindowFlags(2))

        bimpy.push_font(self.fonts.fonts[16]["cond"])
        bimpy.text_colored(bimpy.Vec4(1, 0, 0, 1), "Power")
        bimpy.pop_font()
        bimpy.separator()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.text("")
        bimpy.same_line(25, 0)
        bimpy.text("{:.2f}".format(self.data.power).rjust(6, "0"))
        bimpy.pop_font()

        bimpy.push_font(self.fonts.fonts[44]["ext_bold_ital"])
        bimpy.same_line(212, 0)
        bimpy.text("Watts")
        bimpy.pop_font()

        self.power_datas.append(self.data.power)
        self.power_datas.pop(0)

        self.power_datas.reverse()
        bimpy.plot_lines("",
                         self.power_datas,
                         graph_size=bimpy.Vec2(329, 112),
                         scale_min=-1.0,
                         scale_max=500.0)
        self.power_datas.reverse()

        bimpy.end()
コード例 #23
0
    def render(self):
        # display_size = bimpy.get_display_size()
        window_pos = bimpy.Vec2(self._distance, self._distance)
        window_pos_pivot = bimpy.Vec2(0.0, 0.0)
        bimpy.set_next_window_pos(window_pos, bimpy.Condition.FirstUseEver, window_pos_pivot)
        bimpy.set_next_window_bg_alpha(0.35)

        flags = bimpy.WindowFlags.NoDecoration \
              | bimpy.WindowFlags.AlwaysAutoResize \
              | bimpy.WindowFlags.NoSavedSettings \
              | bimpy.WindowFlags.NoFocusOnAppearing \
              | bimpy.WindowFlags.NoFocusOnAppearing \
              | bimpy.WindowFlags.NoNav
        
        if bimpy.begin("logging overlay##logging_tools", flags=flags):
            if bimpy.is_mouse_pos_valid(None):
                mouse_pos = bimpy.get_mouse_pos()
                bimpy.text("Mouse Pos: ({:.1f},{:.1f})".format(mouse_pos.x, mouse_pos.y))
            else:
                bimpy.text("Mouse Pos: <invalid>")

        bimpy.end()
コード例 #24
0
ファイル: frames.py プロジェクト: RatchetModding/slimseditor
    def render(self):
        if not self._size:
            self._size = bimpy.Vec2(400, 600)
            bimpy.set_next_window_size(self._size)

        if bimpy.begin(self.name,
                       self.opened,
                       flags=bimpy.WindowFlags.NoCollapse
                       | bimpy.WindowFlags.MenuBar):

            if bimpy.begin_menu_bar():
                bimpy.menu_item('Reload', 'Cmd+R', self.click_states['reload'])
                bimpy.end_menu_bar()

            for folder_name, folder_files in self.tree.items():
                if bimpy.collapsing_header(folder_name):
                    for item, button_name in folder_files:
                        if bimpy.button(button_name):
                            item_path = '{0}/{1}'.format(folder_name, item)
                            try:
                                new_savegame = SaveGameFrame(
                                    PS2WrappedBinBackend, item_path, self)
                                self.child_frames.append(new_savegame)

                            except KeyboardInterrupt as e:
                                raise e
                            except Exception as e:
                                print(e)

                        bimpy.same_line()
                        bimpy.text(item)

            bimpy.end()

            for child_frame in self.child_frames:
                child_frame.render()
コード例 #25
0
        rotation = np.array([[np.cos(alpha), np.sin(alpha)],
                             [-np.sin(alpha), np.cos(alpha)]])
        x = np.matmul(x, scale)
        x = np.matmul(x, rotation)
        x += position
        datapoints.append((x, rotation, position, scale))


axis = x = np.array([[-1, 0], [1, 0], [0, -1], [0, 1]])

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

    bimpy.set_next_window_pos(bimpy.Vec2(20, 20), bimpy.Condition.Once)
    bimpy.set_next_window_size(bimpy.Vec2(800, 600), bimpy.Condition.Once)
    bimpy.begin("Drawings")

    window_pos = bimpy.get_window_pos()

    center = bimpy.Vec2(100, 100) + window_pos
    m = 100.0
    for i in range(len(datapoints)):
        (x, R, P, S) = datapoints[i]

        for j in range(x.shape[0]):
            point = bimpy.Vec2(x[j, 0], x[j, 1])
            bimpy.add_circle_filled(point * m + center, 5,
                                    0xAF000000 + colors[i], 100)

        axis_ = np.matmul(axis, S * 2.0)
        axis_ = np.matmul(axis_, R) + P
コード例 #26
0
ファイル: widgets.py プロジェクト: zakx/bimpy
opened = bimpy.Bool(True)

a = 0.0

mylist = ["aaa", "bbb", "ccc"]

selectedItem = bimpy.Int()

vals = [0., 0.1, 0.2, 0.1, 0.4, 0.2]

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

    if opened.value:
        if bimpy.begin("Hello!", opened=opened):
            bimpy.columns(4, "mycolumns")
            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("!!!")
コード例 #27
0
ファイル: sliders.py プロジェクト: zakx/bimpy
#vertical slider 
f4 = bimpy.Float();
f5 = bimpy.Float();
    
#slider_angle
f6 = bimpy.Float();

#slider int2
i1 = bimpy.Int();
i2 = bimpy.Int();

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

    bimpy.begin("Sliders!", flags=bimpy.WindowFlags.AlwaysAutoResize)
    
    bimpy.slider_float3("float3", f1, f2, f3, 0.0, 1.0)
    
    bimpy.v_slider_float("v_slider", bimpy.Vec2(20, 300), f4, 0.0, 1.0)
    
    bimpy.same_line()
    
    bimpy.v_slider_float("v_slider2", bimpy.Vec2(50, 300), f5, -100.0, 100.0, "[%.1f]")
    
    bimpy.slider_angle("slider_angle", f6, -100.0, 100.0)
    
    bimpy.slider_int2("slider_int2", i1, i2, 0, 100)
    
    bimpy.end()
コード例 #28
0
ファイル: Brisk.py プロジェクト: Jxhnn/Brisk
BarColor = bimpy.Vec4(0.16078431, 0.2901960, 0.47843137, 0.95)
HeaderColor = bimpy.Vec4(0.25882352, 0.58823529, 0.9803921568, 0.95)
HeaderHoverColor = bimpy.Vec4(0.43529411, 0.694117647, 0.9803921568, 0.95)
TextColor = bimpy.Vec4(1, 1, 1, 1)
SliderColor = bimpy.Vec4(0.06078431, 0.1901960, 0.47843137, 0.95)
SliderActiveColor = bimpy.Vec4(0.16078431, 0.2901960, 0.47843137, 0.95)
CheckMarkColor = bimpy.Vec4(0.43529411, 0.694117647, 0.9803921568, 0.95)

ctx.init(520, 320, "")
print("Loading...")
while (not ctx.should_close()):
    ctx.new_frame()

    if True:
        if bimpy.begin("",
                       flags=(bimpy.WindowFlags.NoSavedSettings
                              | bimpy.WindowFlags.NoMove
                              | bimpy.WindowFlags.NoResize)):
            bimpy.text("NeX")
            bimpy.push_style_var(bimpy.Style.Alpha, 255)
            bimpy.set_window_size("", bimpy.Vec2(450, 250))
            bimpy.text("")
            #bimpy.set_style(bimpy.GuiStyle.alpha)
            if MinCPS.value > MaxCPS.value:
                MinCPS = bimpy.Float(MaxCPS.value)
            if bimpy.collapsing_header("AutoClicker"):
                bimpy.slider_float("CPS Min", MinCPS, 5.0, 25.0)
                bimpy.slider_float("CPS Max", MaxCPS, 5.0, 25.0)
                if bimpy.button("Toggle"):
                    Toggle = not Toggle
            if bimpy.collapsing_header("Colors"):
                bimpy.color_edit("Main Bar", BarColor)
コード例 #29
0
a = 0.0

mylist = ["aaa", "bbb", "ccc"]

selectedItem = bimpy.Int()

vals = [0., 0.1, 0.2, 0.1, 0.4, 0.2]

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

    bimpy.show_test_window()

    if opened.value:
        if bimpy.begin("Hello!", opened=opened):
            bimpy.columns(4, "mycolumns")
            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("!!!")
コード例 #30
0
ファイル: tester.py プロジェクト: njazz/syphonpy
    try:
        tex1 = make_tex(val1)
        server.publish_frame_texture(tex1, syphonpy.MakeRect(0, 0, 640, 480),
                                     syphonpy.MakeSize(640, 480), False)
        val1 += 1

        bimpy.image(tex1, bimpy.Vec2(640, 480))
        bimpy.text(str(_texture))

        bimpy.text(server.context())
        pass
    except Exception as e:
        bimpy.text(str(e))

    bimpy.begin("Client")
    if bimpy.begin_combo("Source", sel_str):
        lst = syphonpy.ServerDirectory.servers()

        for k in lst:
            if bimpy.selectable(k.name + " : " + k.app_name):
                client = syphonpy.SyphonClient(k)
                sel_str = k.name + " : " + k.app_name

        bimpy.end_combo()

    _tex = 0
    if client:
        # _tex = glGenTextures(1)
        img = client.new_frame_image()
        # glBindTexture(GL_TEXTURE_2D, _tex)
コード例 #31
0
end_rect_action = action_add_annotation

while (not ctx.should_close()):
    ctx.new_frame()
    bimpy.show_demo_window()  # Widget reference

    if bimpy.begin_main_menu_bar():
        if bimpy.menu_item('Save', ''):
            save_data(args.save_path)
        if bimpy.menu_item('Load', ''):
            load_data(args.save_path)
        bimpy.end_main_menu_bar(
        )  # According to bimpy docs, this is a special case where end is called inside the if.

    if bimpy.begin("Video", opened=tab_video_view):
        is_placing_rect = True
        s = bimpy.text(args.base_path_video)
        b_i = bimpy.Int(display_frame)
        bimpy.slider_int("Frame", b_i, 0, video_len, "%d")

        if bimpy.button(" < Prev (z) ") or bimpy.is_key_released(ord('Z')):
            b_i.value -= 1
        bimpy.same_line()
        bimpy.checkbox("Autoplay (c to stop)", is_autoplay)
        if bimpy.is_key_down(ord('C')):
            is_autoplay.value = False
        bimpy.same_line()
        if bimpy.button(" Next > (x) ") or bimpy.is_key_released(
                ord('X')) or is_autoplay.value:
            b_i.value += 1