Fixed onload size alloc being incorrect, added settings params

This commit is contained in:
itdominator 2023-04-28 21:09:44 -05:00
parent 29b32a9dc3
commit 1f0760492b
3 changed files with 19 additions and 13 deletions

View File

@ -46,18 +46,18 @@ class ImageView(ImageViewMixin, Gtk.Image):
...
def _subscribe_to_events(self):
event_system.subscribe("zoom_out", self._zoom_out)
event_system.subscribe("size_allocate", self._size_allocate)
event_system.subscribe("handle_file_from_dnd", self._handle_file_from_dnd)
event_system.subscribe("vertical_flip", self._vertical_flip)
event_system.subscribe("zoom_out", self._zoom_out)
event_system.subscribe("rotate_left", self._rotate_left)
event_system.subscribe("vertical_flip", self._vertical_flip)
event_system.subscribe("scale_1_two_1", self._scale_1_two_1)
event_system.subscribe("fit_to_container", self._fit_to_container)
event_system.subscribe("horizontal_flip", self._horizontal_flip)
event_system.subscribe("rotate_right", self._rotate_right)
event_system.subscribe("zoom_in", self._zoom_in)
event_system.subscribe("size_allocate", self._size_allocate)
def _load_widgets(self):
...
@ -85,9 +85,11 @@ class ImageView(ImageViewMixin, Gtk.Image):
if not self.work_pixbuff:
self.set_as_static(path)
self.pixbuff = self.work_pixbuff
self.pixbuff = self.work_pixbuff.copy()
if self.fit_to_win:
self._fit_to_container()
else:
self._scale_1_two_1()
def set_as_gif(self, path):
image = None

View File

@ -15,12 +15,11 @@ from gi.repository import GLib
from core.controller import Controller
class ControllerStartExceptiom(Exception):
...
class Window(Gtk.ApplicationWindow):
""" docstring for Window. """
@ -29,26 +28,30 @@ class Window(Gtk.ApplicationWindow):
self._controller = None
settings.set_main_window(self)
self._set_window_data()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
settings.set_main_window(self)
self._load_widgets(args, unknownargs)
self.show()
# NOTE: Need to set size after show b/c get_allocation methods are initially incorrect if done beforehand...
self.set_given_size()
def _setup_styling(self):
self.set_size_request(720, 480)
self.set_default_size(settings.get_main_window_width(),
settings.get_main_window_height())
self.set_title(f"{app_name}")
self.set_icon_from_file( settings.get_window_icon() )
self.set_gravity(5) # 5 = CENTER
self.set_position(1) # 1 = CENTER, 4 = CENTER_ALWAYS
def set_given_size(self):
self.set_default_size(settings.get_main_window_width(),
settings.get_main_window_height())
self.set_size_request(720, 480)
def _setup_signals(self):
self.connect("delete-event", self._tear_down)
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, self._tear_down)

View File

@ -11,7 +11,8 @@
"terminal_app": "terminator",
"max_ring_thumbnail_list": 10,
"thumbnail_with": 256,
"thumbnail_height": 256
"thumbnail_height": 256,
"make_transparent": 0
},
"filters": {
"meshs": [".dae", ".fbx", ".gltf", ".obj", ".stl"],