Benjamin Althues avatar Benjamin Althues committed f806072

Remove unneeded setter methods

Comments (0)

Files changed (3)

 import algos
 
 from dispass import versionStr
-from filehandler import Filehandler
 
 try:
     import curses
     createLabel = False
     '''Boolean. Prompt for password twice and save label to labelfile'''
 
-    scriptableIO = None
+    scriptableIO = False
     '''Boolean. Optimize input/output for wrapping dispass'''
 
     passphrases = []
         self.settings = settings
         self.useCurses = hasCurses
 
-    def setAlgo(self, algo):
-        '''Optionally override the algorithm to use for generating passphrases
-
-        :Parameters:
-            - `algo`: String. Name of the algorithm
-        '''
-
-        self.algorithm = algo
-
-    def setSeqNo(self, seqno):
-        '''Optionally override the sequence number to use
-
-        :Parameters:
-            - `algo`: String. Name of the algorithm
-        '''
-
-        self.seqno = seqno
-
     def setCurses(self, useCurses):
         '''Optionally override `self.useCurses`
 
         else:
             self.useCurses = useCurses
 
-    def setScriptableIO(self, scriptableIO=True):
-        '''Optimize input/output for wrapping dispass in a script or program
-
-        :Parameters:
-            - `sriptableIO`: Boolean
-        '''
-
-        self.scriptableIO = scriptableIO
-
-    def setLength(self, length):
-        '''Optionally override length of output passphrase
-
-        :Parameters:
-            - `length`: Integer. Length of output passphrase
-        '''
-
-        self.passphraseLength = length
-
     def passwordPrompt(self):
         '''Prompt for password.
 

dispass/dispass.py

             elif o in ("-a", "--algo"):
                 algoname = a.lower()
                 if algoname in algos.algorithms:
-                    console.setAlgo(algoname)
+                    console.algorithm = algoname
                 else:
                     print 'error: algo "{algo}" does not exist'.format(algo=a)
                     return 1
                     print 'error: sequence number must be a number\n'
                     self.usage()
                     return 1
-                console.setSeqNo(seqno)
+                console.seqno = seqno
             elif o in ("-c", "--create"):
                 console.createLabel = True
             elif o in ("-l", "--length"):
                     print 'error: length must be a number\n'
                     self.usage()
                     return 1
-                console.setLength(length)
+                console.passphraseLength = length
             elif o in ("-f", "--file"):
                 f_flag = a
             elif o in ("-s", "--search"):
                 print versionStr, '-', __version_info__, 'running on', os.name
                 return
             elif o in "--script":
-                console.setScriptableIO()
+                console.scriptableIO = True
             else:
                 assert False, "unhandled option"
 
         self.grid()
         self.createWidgets()
 
-# GUI # Setters and getters
-    def setFont(self):
-        '''Set font and fontsize; not used at this moment'''
-        pass
-
     def getFont(self, sizediff=0):
         '''Get `font` and `fontsize`, optionally differ from default `fontsize`
 
 
         return (self.font, self.fontsize + sizediff)
 
-# GUI # Prototypes
     def warn(self, message, warning_type='soft', box_title=''):
         '''Prototype for warning user
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.