exclude: fix vertical mode, fix last object cancel and make it exit
This commit is contained in:
parent
d3281379ee
commit
17e4bb704e
@ -36,17 +36,17 @@ class ExcludeObjectPanel(ScreenPanel):
|
|||||||
self.add_object(obj["name"])
|
self.add_object(obj["name"])
|
||||||
|
|
||||||
scroll = self._gtk.ScrolledWindow()
|
scroll = self._gtk.ScrolledWindow()
|
||||||
|
scroll.set_size_request((self._screen.width * .9) // 2, -1)
|
||||||
scroll.add(self.object_list)
|
scroll.add(self.object_list)
|
||||||
scroll.set_halign(Gtk.Align.CENTER)
|
scroll.set_halign(Gtk.Align.CENTER)
|
||||||
scroll.set_size_request(self._gtk.get_content_width() // 2, 0)
|
|
||||||
|
|
||||||
grid = Gtk.Grid()
|
grid = self._gtk.HomogeneousGrid()
|
||||||
|
grid.set_row_homogeneous(False)
|
||||||
grid.attach(self.current_object, 0, 0, 2, 1)
|
grid.attach(self.current_object, 0, 0, 2, 1)
|
||||||
grid.attach(Gtk.Separator(), 0, 1, 2, 1)
|
grid.attach(Gtk.Separator(), 0, 1, 2, 1)
|
||||||
|
|
||||||
if self.objects and "polygon" in self.objects[0]:
|
if self.objects and "polygon" in self.objects[0]:
|
||||||
self.labels['map'] = ObjectMap(self._screen, self._printer, self._gtk.get_font_size())
|
self.labels['map'] = ObjectMap(self._screen, self._printer, self._gtk.get_font_size())
|
||||||
self.labels['map'].set_size_request(self._gtk.get_content_width() // 2, 0)
|
|
||||||
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
grid.attach(self.labels['map'], 0, 2, 1, 1)
|
||||||
grid.attach(scroll, 1, 2, 1, 1)
|
grid.attach(scroll, 1, 2, 1, 1)
|
||||||
else:
|
else:
|
||||||
@ -58,15 +58,14 @@ class ExcludeObjectPanel(ScreenPanel):
|
|||||||
def add_object(self, name):
|
def add_object(self, name):
|
||||||
if name not in self.buttons and name not in self.excluded_objects:
|
if name not in self.buttons and name not in self.excluded_objects:
|
||||||
self.buttons[name] = self._gtk.Button(name.replace("_", " "))
|
self.buttons[name] = self._gtk.Button(name.replace("_", " "))
|
||||||
self.buttons[name].get_children()[0].set_line_wrap_mode(Pango.WrapMode.CHAR)
|
self.buttons[name].get_children()[0].set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
|
||||||
self.buttons[name].get_children()[0].set_line_wrap(True)
|
self.buttons[name].get_children()[0].set_line_wrap(True)
|
||||||
self.buttons[name].connect("clicked", self.exclude_object, name)
|
self.buttons[name].connect("clicked", self.exclude_object, name)
|
||||||
self.buttons[name].set_hexpand(True)
|
|
||||||
self.buttons[name].get_style_context().add_class("frame-item")
|
self.buttons[name].get_style_context().add_class("frame-item")
|
||||||
self.object_list.add(self.buttons[name])
|
self.object_list.add(self.buttons[name])
|
||||||
|
|
||||||
def exclude_object(self, widget, name):
|
def exclude_object(self, widget, name):
|
||||||
if len(self.buttons) == 1:
|
if len(self.excluded_objects) == len(self.objects) - 1:
|
||||||
# Do not exclude the last object, this is a workaround for a bug of klipper that starts
|
# Do not exclude the last object, this is a workaround for a bug of klipper that starts
|
||||||
# to move the toolhead really fast skipping gcode until the file ends
|
# to move the toolhead really fast skipping gcode until the file ends
|
||||||
# Remove this if they fix it.
|
# Remove this if they fix it.
|
||||||
@ -112,6 +111,8 @@ class ExcludeObjectPanel(ScreenPanel):
|
|||||||
if name in self.buttons:
|
if name in self.buttons:
|
||||||
self.object_list.remove(self.buttons[name])
|
self.object_list.remove(self.buttons[name])
|
||||||
self.update_graph()
|
self.update_graph()
|
||||||
|
if len(self.excluded_objects) == len(self.objects):
|
||||||
|
self.menu_return(False)
|
||||||
elif action == "notify_gcode_response" and "Excluding object" in data:
|
elif action == "notify_gcode_response" and "Excluding object" in data:
|
||||||
self._screen.show_popup_message(data, level=1)
|
self._screen.show_popup_message(data, level=1)
|
||||||
self.update_graph()
|
self.update_graph()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user