Esempio n. 1
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()
Esempio n. 2
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()
Esempio n. 3
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()
Esempio n. 4
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()
Esempio n. 5
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()
Esempio n. 6
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()
Esempio n. 7
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")
Esempio n. 8
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()
Esempio n. 9
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()
Esempio n. 10
0
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()
Esempio n. 11
0
    def retrival(self):

        ###########UI###########
        size = bimpy.Vec2(500, 750)
        bimpy.set_next_window_size(size, bimpy.Condition.Once)

        if bimpy.begin_popup_modal('{}: {}'.format(LANG.retrieve, self.select_label)) \
                and self.select_label != '' and self.first_init:

            for idx, file in enumerate(
                    self.r.label2pic[self.select_label.lower()]):
                if idx != 0:
                    bimpy.separator()

                img = self.r.get_thumbnail(file)
                bimpy.text(file)
                bimpy.image(img)

            bimpy.separator()

            if bimpy.button(LANG.retrieve_close):
                bimpy.clode_current_popup()
            bimpy.end_popup()
        ########################

        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,
        }

        return t
Esempio n. 12
0
File: utils.py Progetto: 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()
Esempio n. 13
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
Esempio n. 14
0
    def render(self, origin: bimpy.Vec2, scale: float):
        if not self._convex_points:
            return

        points_on_canvas = [
            bimpy.Vec2(item.x * scale + origin.x, item.y * -scale + origin.y)
            for item in self._convex_points
        ]

        bimpy.add_convex_poly_filled(points_on_canvas, im_col32(50, 50, 50))
    def validate_cache(self) -> bool:
        if self.cache_events is None or not self.viewport.validate_cache():
            self.cache_events = []

            for ev in self.events:
                if isinstance(ev, NoteEvent):
                    cached_event = EventsPreview.CachedEvent(self.viewport, ev)

                    if cached_event.visible:
                        self.cache_events.append(cached_event)

            self.cache_rect_start = bimpy.Vec2(self.margins[3],
                                               self.margins[0])
            self.cache_rect_end = bimpy.Vec2(self.width - self.margins[1],
                                             self.height - self.margins[2])

            return False

        return True
Esempio n. 16
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()
Esempio n. 17
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()
Esempio n. 18
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()
Esempio n. 19
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()
        def __init__(self, viewport, event: NoteEvent):
            self.event: NoteEvent = event

            self.visible: bool = False
            self.start_pos: bimpy.Vec2 = None
            self.end_pos: bimpy.Vec2 = None

            y = viewport.get_pitch_y(int(event))

            if y is not None:
                start_x = viewport.get_time_x(event.timestamp)
                end_x = viewport.get_time_x(event.end_timestamp)

                if start_x is not None or end_x is not None:
                    if start_x is None: start_x = 0
                    if end_x is None: end_x = viewport.width

                    self.visible = True

                    self.start_pos = bimpy.Vec2(start_x, y)
                    self.end_pos = bimpy.Vec2(end_x, y)
Esempio n. 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()
Esempio n. 22
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()
Esempio n. 23
0
def drawPathFinder(columns_count=7, lines_count=5):
    bimpy.columns(columns_count, None, borders_vertical)
    i = 0
    while i != columns_count:
        i += 1
        if borders_horizontal and bimpy.get_column_index == 0:
            bimpy.separator()
        #bimpy.text("{}".format("a"))
        bimpy.button("Auto Path", bimpy.Vec2(100,100))
        bimpy.next_column()
    bimpy.columns(1)
    if borders_horizontal:
        bimpy.separator()
Esempio n. 24
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()
Esempio n. 25
0
def drawMainTab(columns_count=7, lines_count=5):
    bimpy.columns(columns_count, None, borders_vertical)
    i = 0
    col_c = 0
    while col_c > lines_count:
        col_c += 1
    while i != columns_count:
        if borders_horizontal and bimpy.get_column_index == 0:
            bimpy.separator()
        #bimpy.text("{}".format("a"))
        bimpy.button(field_names[i], bimpy.Vec2(100,100))
        bimpy.next_column()
        i += 1
    columns_count = 0
    bimpy.columns(1)
    if borders_horizontal:
        bimpy.separator()
Esempio n. 26
0
    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()
Esempio n. 27
0
    def render(self, origin: bimpy.Vec2, scale: float):
        points_on_canvas = [
            bimpy.Vec2(item.x * scale + origin.x,
                       item.y * -scale + origin.y)
            for item in self._convex_points
        ]

        for index in range(len(points_on_canvas) - 1):
            bimpy.add_line(
                points_on_canvas[index],
                points_on_canvas[index + 1],
                im_col32(211, 85, 186),
                1.0,
            )
        
        for index in range(len(points_on_canvas)):
            bimpy.add_circle_filled(
                points_on_canvas[index],
                2.0,
                im_col32(204, 50, 153),
                16,
            )
Esempio n. 28
0
    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()
Esempio n. 29
0
sel_str = ""
img = None
fbo = glGenFramebuffers(1)

_converted = glGenTextures(1)

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

    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
Esempio n. 30
0
 def render(self):
     if not self._size:
         self._size = bimpy.Vec2(400, 600)
         bimpy.set_next_window_size(self._size)