~martijnbraam/thumbdrives

c7e19df2774186d2a05c1dbdffd9d000a762c0bb — Martijn Braam 2 years ago 2024dbe 0.2.2
UI Cleanup
3 files changed, 62 insertions(+), 5 deletions(-)

M src/pk-thumbdrive-action.sh
M src/window.py
M src/window.ui
M src/pk-thumbdrive-action.sh => src/pk-thumbdrive-action.sh +1 -1
@@ 80,8 80,8 @@ create_gadget () {
	echo "Thumbdrive" > $LOCALE/configuration

	# Link mass storage gadget to backing file
	echo $backing > $LUN/file
	echo $devtype > $LUN/cdrom
	echo $backing > $LUN/file

	# Mass storage hardware name
	echo "Thumbdrives" > $LUN/inquiry_string

M src/window.py => src/window.py +25 -0
@@ 25,6 25,11 @@ class ThumbdrivesWindow(Gtk.ApplicationWindow):
    thumbdrive_list = Gtk.Template.Child()
    iso_list = Gtk.Template.Child()

    frame_thumbdrive = Gtk.Template.Child()
    no_thumbdrive = Gtk.Template.Child()
    frame_iso = Gtk.Template.Child()
    no_iso = Gtk.Template.Child()

    def __init__(self, **kwargs):
        super().__init__(**kwargs)



@@ 47,6 52,7 @@ class ThumbdrivesWindow(Gtk.ApplicationWindow):

        self.thumbdrive_list.show_all()
        self.iso_list.show_all()
        self.update_visibility()

    def add_img(self, path):
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)


@@ 72,6 78,25 @@ class ThumbdrivesWindow(Gtk.ApplicationWindow):
        box.filename = str(path)
        self.iso_list.insert(box, -1)

    def update_visibility(self):
        has_thumbdrives = len(list(self.thumbdrive_list)) > 0
        has_iso = len(list(self.iso_list)) > 0

        if has_thumbdrives:
            self.no_thumbdrive.hide()
            self.frame_thumbdrive.show()
        else:
            self.no_thumbdrive.show()
            self.frame_thumbdrive.hide()

        if has_iso:
            self.no_iso.hide()
            self.frame_iso.show()
        else:
            self.no_iso.show()
            self.frame_iso.hide()


    def update_mounted(self):
        filename = vdisk.get_mounted()
        if filename is None:

M src/window.ui => src/window.ui +36 -4
@@ 122,7 122,7 @@
                      </packing>
                    </child>
                    <child>
                      <object class="GtkFrame">
                      <object class="GtkFrame" id="frame_thumbdrive">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="margin_top">12</property>


@@ 157,6 157,22 @@
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLabel" id="no_thumbdrive">
                        <property name="can_focus">False</property>
                        <property name="margin_bottom">24</property>
                        <property name="label" translatable="yes">There are no thumbdrive images yet.
Add a thumbdrive to get started</property>
                        <style>
                          <class name="dim-label"/>
                        </style>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">2</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkBox">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>


@@ 199,11 215,11 @@
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">2</property>
                        <property name="position">3</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkFrame">
                      <object class="GtkFrame" id="frame_iso">
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="margin_top">12</property>


@@ 234,7 250,23 @@
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">3</property>
                        <property name="position">4</property>
                      </packing>
                    </child>
                    <child>
                      <object class="GtkLabel" id="no_iso">
                        <property name="can_focus">False</property>
                        <property name="label" translatable="yes">There are no CD/DVD images yet.
Use the add button to download one of the templates or download an .iso file into ~/Downloads to get started</property>
                        <property name="wrap">True</property>
                        <style>
                          <class name="dim-label"/>
                        </style>
                      </object>
                      <packing>
                        <property name="expand">False</property>
                        <property name="fill">True</property>
                        <property name="position">5</property>
                      </packing>
                    </child>
                  </object>