[master 4/9] iscsi gui: use abstract methods in the iSCSIWizard interface.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is an attempt to do the interface class properly, forcing overriding
of the methods. This is in preparation for making the addIscsiDrive() code
same for both the GUI/TUI.
---
 pyanaconda/iw/advanced_storage.py |    5 +---
 pyanaconda/partIntfHelpers.py     |   47 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/iw/advanced_storage.py b/pyanaconda/iw/advanced_storage.py
index 12821a0..e6973f9 100644
--- a/pyanaconda/iw/advanced_storage.py
+++ b/pyanaconda/iw/advanced_storage.py
@@ -198,10 +198,7 @@ class iSCSILoginDialog(iSCSICredentialsDialog):
 
         return dct
 
-class iSCSIWizard(object):
-    pass
-
-class iSCSIGuiWizard(object):
+class iSCSIGuiWizard(partIntfHelpers.iSCSIWizard):
     NODE_NAME_COL = DeviceSelector.IMMUTABLE_COL + 1
 
     def __init__(self):
diff --git a/pyanaconda/partIntfHelpers.py b/pyanaconda/partIntfHelpers.py
index 753ad4c..e3bd2fd 100644
--- a/pyanaconda/partIntfHelpers.py
+++ b/pyanaconda/partIntfHelpers.py
@@ -24,6 +24,7 @@
 
 """Helper functions shared between partitioning interfaces."""
 
+from abc import ABCMeta, abstractmethod
 import string
 from constants import *
 import parted
@@ -354,7 +355,51 @@ def confirmResetPartitionState(intf):
     return rc
 
 
-""" iSCSI GUI helper functions """
+""" iSCSI GUI helper objects """
+
+class iSCSIWizard():
+    """
+    A base class for both the GUI and TUI iSCSI wizards.
+
+    To get an instantiable class, all its methods have to be overriden.
+    """
+    __metaclass__ = ABCMeta
+    
+    @abstractmethod
+    def destroy_dialogs(self):
+        pass
+
+    @abstractmethod
+    def display_discovery_dialog(self, initiator, initiator_set):
+        pass
+
+    @abstractmethod
+    def display_login_dialog(self):
+        pass
+
+    @abstractmethod
+    def display_nodes_dialog(self, found_nodes):
+        pass
+
+    @abstractmethod
+    def display_success_dialog(self, success_nodes, fail_nodes, fail_reason):
+        pass
+
+    @abstractmethod
+    def get_discovery_dict(self):
+        pass
+
+    @abstractmethod
+    def get_initiator(self):
+        pass
+
+    @abstractmethod
+    def get_login_dict(self):
+        pass
+
+    @abstractmethod
+    def set_initiator(self, initiator, initiator_set):
+        pass
 
 def drive_iscsi_addition(anaconda, wizard):
     """
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux