Splitted main layout in widgets, implemented widgets loader
This commit is contained in:
parent
e22f17dbc1
commit
96c675c6b8
@ -4,3 +4,5 @@ data/eu.ichibi.Lumos.gschema.xml
|
||||
src/main.py
|
||||
src/window.py
|
||||
src/window.ui
|
||||
src/widgets/time_priority_page.py
|
||||
src/widgets/time_priority_page.ui
|
||||
|
@ -2,6 +2,7 @@
|
||||
<gresources>
|
||||
<gresource prefix="/eu/ichibi/Lumos">
|
||||
<file preprocess="xml-stripblanks">window.ui</file>
|
||||
<file preprocess="xml-stripblanks">widgets/time_priority_page.ui</file>
|
||||
<file preprocess="xml-stripblanks">gtk/help-overlay.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
@ -26,6 +26,7 @@ gi.require_version('Adw', '1')
|
||||
|
||||
from gi.repository import Gtk, Gio, Adw
|
||||
from .window import LumosWindow
|
||||
from .widgets_loader import registerWidgets
|
||||
|
||||
|
||||
class LumosApplication(Adw.Application):
|
||||
@ -44,6 +45,11 @@ class LumosApplication(Adw.Application):
|
||||
We raise the application's main window, creating it if
|
||||
necessary.
|
||||
"""
|
||||
|
||||
# Register all widgets
|
||||
registerWidgets();
|
||||
|
||||
# Create window
|
||||
win = self.props.active_window
|
||||
if not win:
|
||||
win = LumosWindow(application=self)
|
||||
|
@ -30,6 +30,8 @@ lumos_sources = [
|
||||
'__init__.py',
|
||||
'main.py',
|
||||
'window.py',
|
||||
'widgets/widgets_loader.py',
|
||||
'widgets/time_priority_page.py',
|
||||
]
|
||||
|
||||
install_data(lumos_sources, install_dir: moduledir)
|
||||
|
26
src/widgets/time_priority_page.py
Normal file
26
src/widgets/time_priority_page.py
Normal file
@ -0,0 +1,26 @@
|
||||
# time_priority_page.py
|
||||
#
|
||||
# Copyright 2024 Daniele Verducci
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from gi.repository import Adw
|
||||
from gi.repository import Gtk
|
||||
|
||||
@Gtk.Template(resource_path='/eu/ichibi/Lumos/widgets/time_priority_page.ui')
|
||||
class TimePriorityPage(Gtk.Box):
|
||||
__gtype_name__ = 'TimePriorityPage'
|
||||
|
76
src/widgets/time_priority_page.ui
Normal file
76
src/widgets/time_priority_page.ui
Normal file
@ -0,0 +1,76 @@
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="adw" version="1.0"/>
|
||||
<template class="TimePriorityPage" parent="GtkBox">
|
||||
<property name="orientation">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="halign">3</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">camera-timer-symbolic</property>
|
||||
<property name="pixel-size">64</property>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Time priority</property>
|
||||
<style>
|
||||
<class name="title-1"/>
|
||||
</style>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Set this aperture value:</property>
|
||||
<property name="margin-bottom">15</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="time-priority-aperture-label">
|
||||
<property name="label" translatable="no">f/11</property>
|
||||
<style>
|
||||
<class name="lumos-big-result"/>
|
||||
</style>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Your camera's time setting is:</property>
|
||||
<property name="margin-bottom">15</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropDown" id="time-priority-speed-dropdown">
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item translatable="no">1/ 4000</item>
|
||||
<item translatable="no">1/ 2000</item>
|
||||
<item translatable="no">1/ 1000</item>
|
||||
<item translatable="no">1/ 500</item>
|
||||
<item translatable="no">1/ 250</item>
|
||||
<item translatable="no">1/ 125</item>
|
||||
<item translatable="no">1/ 60</item>
|
||||
<item translatable="no">1/ 30</item>
|
||||
<item translatable="no">1/ 15</item>
|
||||
<item translatable="no">1/ 8</item>
|
||||
<item translatable="no">1/ 4</item>
|
||||
<item translatable="no">1/ 2</item>
|
||||
<item translatable="no">1 sec</item>
|
||||
<item translatable="no">2 sec</item>
|
||||
<item translatable="no">4 sec</item>
|
||||
<item translatable="no">8 sec</item>
|
||||
<item translatable="no">15 sec</item>
|
||||
<item translatable="no">30 sec</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
|
||||
|
8
src/widgets/widgets_loader.py
Normal file
8
src/widgets/widgets_loader.py
Normal file
@ -0,0 +1,8 @@
|
||||
from gi.repository import GObject
|
||||
|
||||
from .time_priority_page import TimePriorityPage
|
||||
|
||||
# Register widgets to be used in templates UI
|
||||
def registerWidgets() -> None:
|
||||
GObject.type_ensure(TimePriorityPage)
|
||||
|
@ -53,75 +53,7 @@
|
||||
<property name="icon-name">camera-timer-symbolic</property>
|
||||
<property name="use-underline">true</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">1</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="halign">3</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="icon-name">camera-timer-symbolic</property>
|
||||
<property name="pixel-size">64</property>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Time priority</property>
|
||||
<style>
|
||||
<class name="title-1"/>
|
||||
</style>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Set this aperture value:</property>
|
||||
<property name="margin-bottom">15</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="time-priority-aperture-label">
|
||||
<property name="label" translatable="no">f/11</property>
|
||||
<style>
|
||||
<class name="title-1"/>
|
||||
</style>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Your camera's time setting is:</property>
|
||||
<property name="margin-bottom">15</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropDown" id="time-priority-speed-dropdown">
|
||||
<property name="model">
|
||||
<object class="GtkStringList">
|
||||
<items>
|
||||
<item translatable="no">1/ 4000</item>
|
||||
<item translatable="no">1/ 2000</item>
|
||||
<item translatable="no">1/ 1000</item>
|
||||
<item translatable="no">1/ 500</item>
|
||||
<item translatable="no">1/ 250</item>
|
||||
<item translatable="no">1/ 125</item>
|
||||
<item translatable="no">1/ 60</item>
|
||||
<item translatable="no">1/ 30</item>
|
||||
<item translatable="no">1/ 15</item>
|
||||
<item translatable="no">1/ 8</item>
|
||||
<item translatable="no">1/ 4</item>
|
||||
<item translatable="no">1/ 2</item>
|
||||
<item translatable="no">1 sec</item>
|
||||
<item translatable="no">2 sec</item>
|
||||
<item translatable="no">4 sec</item>
|
||||
<item translatable="no">8 sec</item>
|
||||
<item translatable="no">15 sec</item>
|
||||
<item translatable="no">30 sec</item>
|
||||
</items>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="TimePriorityPage" id="time-priority-page-widget">
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user