[Pkg-privacy-commits] [tails-installer] 21/70: Fix feature 9005

Ulrike Uhlig ulrike at moszumanska.debian.org
Mon Nov 20 14:54:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to annotated tag tails-installer_4.20
in repository tails-installer.

commit f51ee524959e58dcd3079832c774bf254a8e4d97
Author: kurono <andres.gomez at cern.ch>
Date:   Tue Feb 23 19:12:08 2016 +0100

    Fix feature 9005
    
    Add groups of radio buttons to decide the source device when
    running inside tails.
---
 data/tails-installer.ui | 34 ++++++++++++++++++++--
 tails_installer/gui.py  | 76 +++++++++++++++++--------------------------------
 2 files changed, 58 insertions(+), 52 deletions(-)

diff --git a/data/tails-installer.ui b/data/tails-installer.ui
index 9983582..59bcf42 100644
--- a/data/tails-installer.ui
+++ b/data/tails-installer.ui
@@ -140,6 +140,36 @@
             <property name="orientation">vertical</property>
             <property name="spacing">6</property>
             <child>
+              <object class="GtkRadioButton" id="radio_button_source_iso">
+                <property name="label" translatable="yes">Use an ISO:</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">False</property>
+                <signal name="toggled" handler="on_radio_changed" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="radio_button_source_device">
+                <property name="label" translatable="yes">Use current device:</property>
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">False</property>
+                <property name="group">radio_button_source_iso</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkLabel" id="label_source_file">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -154,7 +184,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">0</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -166,7 +196,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>
diff --git a/tails_installer/gui.py b/tails_installer/gui.py
index faa197e..fca229b 100755
--- a/tails_installer/gui.py
+++ b/tails_installer/gui.py
@@ -384,56 +384,39 @@ class TailsInstallerWindow(Gtk.ApplicationWindow):
         rgba.parse(config['branding']['color'])
         self.__image_header.override_background_color(Gtk.StateFlags.NORMAL, rgba)
 
+    def on_radio_changed(self, radio_button):
+        active_radio = [r for r in radio_button.get_group() if r.get_active()][0]
+        if active_radio.get_label() == "Use current device:":
+            self.opts.clone = True
+        elif active_radio.get_label() == "Use an ISO:":
+            self.opts.clone = False
+
     def on_source_file_set(self, filechooserbutton):
         self.select_source_iso(filechooserbutton.get_filename())
 
     def on_target_changed(self, combobox_target):
-        print("Implement me")
+        if self.opts.clone == None:
+            self.opts.clone = True
+
         # get selected device
-        #drive = get_selected_drive()
-        #device = self.live.drives[drive]
-        #### Inside tails
-        #if is_running_from_tails():
-            # If check box "Clone from ISO"
-            #source = ISO
-            # else if check box "Clone from current device"
-            #source = device
+        drive = self.get_selected_drive()
+        device = self.live.drives[drive]
 
-        # If device has not a valid recognized Tails partition
-        #if not is_device_tails_intallation(self, device):
-           # Install.
-        # else If tails is already there?
-        #else:
-            # If not persistence
-            # Upgrade deleting persistence.
-
-            # else If persistence is there?
-            # Is this a new requirement?
-            # Well yes, this makes a big difference on wether install,
-            # upgrade or etc. hmm, check how difficult is to do it.
-
-            # Upgrade without deleting persistence.
-        self.update_gui_components()
+        # Inside tails
+        if not is_running_from_tails():
+            self.opts.clone = False
 
-    def is_device_tails_intallation(self, device):
-        # Check if the device has a valid Tails partition
-        if not self.opts.partition and not self.live.device_can_be_upgraded(device):
-            if is_running_from_tails():
-                action = _('\"Clone & Install\"')
-            else:
-                action = _('\"Install from ISO\"')
-            pretty_name = self.get_device_pretty_name(info)
-            message = _('It is impossible to upgrade the device %(pretty_name)s'
-                       ' because it was not created using Tails Installer.'
-                       ' You should instead use %(action)s to upgrade Tails'
-                       ' on this device.') % {
-                       'pretty_name' : pretty_name,
-                       'action'      : action
-            }
-            self.status(message)
-            return False
+        # If device has not a valid recognized Tails partition
+        if not self.live.device_can_be_upgraded(device):
+           self.opts.partition = True
         else:
-            return True
+            # If persistence
+            if self.persistence:
+                # Upgrade without deleting it
+                self.opts.partition = False
+            else:
+                self.opts.partition = True
+        self.update_gui_components()
 
     def get_device_pretty_name(self, device):
         size = _format_bytes_in_gb(device['parent_size']
@@ -453,14 +436,6 @@ class TailsInstallerWindow(Gtk.ApplicationWindow):
         }
         return pretty_name
 
-    def is_device_persistence(self, device):
-        # Skip LUKS-encrypted partitions
-        if device['fstype'] and device['fstype'] == 'crypto_LUKS':
-            self.live.log.debug('Skipping LUKS-encrypted partition: %s' % info['device'])
-            return True
-        else:
-            return False
-
     def update_gui_components(self):
         if self.opts.clone or config['download']['enabled']:
             self.source_available = True
@@ -534,6 +509,7 @@ class TailsInstallerWindow(Gtk.ApplicationWindow):
                 # Skip LUKS-encrypted partitions
                 if info['fstype'] and info['fstype'] == 'crypto_LUKS':
                     self.live.log.debug('Skipping LUKS-encrypted partition: %s' % info['device'])
+                    self.persistence = True
                     continue
                 pretty_name = self.get_device_pretty_name(info)
                 # Skip too small devices, but inform the user

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/tails-installer.git



More information about the Pkg-privacy-commits mailing list