Browse Source

Plane edits

pull/1/head
unknown 10 years ago
parent
commit
c6378d85c9
6 changed files with 17 additions and 21 deletions
  1. 4
      src/app/dialogs/action_sorter_unittest.py
  2. 2
      src/app/dialogs/argparse_test_data.py
  3. 2
      src/app/dialogs/base_window.py
  4. 11
      src/app/dialogs/controller.py
  5. 19
      src/app/dialogs/model.py
  6. BIN
      src/app/images/image_store.pyc

4
src/app/dialogs/action_sorter_unittest.py

@ -11,7 +11,7 @@ from functools import partial
from argparse import _StoreAction, _HelpAction
from action_sorter import ActionSorter
class Test(unittest.TestCase):
class TestActionSorter(unittest.TestCase):
def setUp(self):
@ -26,7 +26,7 @@ class Test(unittest.TestCase):
'''_StoreAction(option_strings=['-T', '--tester'], dest='tester', nargs=None, const=None, default=None, type=None, choices=['yes', 'no'], help="Yo, what's up man? I'm a help message!", metavar=None)'''
]
self.expected_optionals = [
'''_StoreAction(option_strings=['-o', '--outfile'], dest='outfile', nargs=None, const=None, default=None, type=None, choices=None, help='Redirects output to the file specified by you, the awesome user', metavar=None)''',
'''_StoreAction(option_strings=['-m', '--moutfile'], dest='moutfile', nargs=None, const=None, default=None, type=None, choices=None, help='Redirects output to the file specified by you, the awesome user', metavar=None)''',
'''_StoreAction(option_strings=['-v', '--verbose'], dest='verbose', nargs=None, const=None, default=None, type=None, choices=None, help='Toggles verbosity off', metavar=None)''',
'''_StoreAction(option_strings=['-s', '--schimzammy'], dest='schimzammy', nargs=None, const=None, default=None, type=None, choices=None, help='Add in an optional shimzammy parameter', metavar=None)'''
]

2
src/app/dialogs/argparse_test_data.py

@ -11,7 +11,7 @@ parser = ArgumentParser(description='Example Argparse Program')
parser.add_argument("filename", help="Name of the file you want to read") # positional
parser.add_argument("outfile", help="Name of the file where you'll save the output") # positional
parser.add_argument('-T', '--tester', choices=['yes','no'], help="Yo, what's up man? I'm a help message!") # Choice
parser.add_argument('-o', '--outfile', help='Redirects output to the file specified by you, the awesome user') # Optional
parser.add_argument('-m', '--moutfile', help='Redirects output to the file specified by you, the awesome user') # Optional
parser.add_argument('-v', '--verbose', help='Toggles verbosity off') # Optional
parser.add_argument('-s', '--schimzammy', help='Add in an optional shimzammy parameter') # Optional
parser.add_argument('-e', '--repeat', action='count', help='Set the number of times to repeat') # Counter

2
src/app/dialogs/base_window.py

@ -31,8 +31,6 @@ class BaseWindow(wx.Frame):
)
self._model = Model.GetInstance()
print self._model
sys.exit()
self._controller = None
self._init_properties()

11
src/app/dialogs/controller.py

@ -5,6 +5,7 @@ Created on Dec 22, 2013
'''
import msg_dialog
from app.dialogs.model import Model
class Controller(object):
'''
@ -29,13 +30,21 @@ class Controller(object):
self._head = head_panel
self._body = body_panel
self._foot = footer_panel
self._model = Model.GetInstance()
def OnConfigCancel(self, event):
print 'OnCongigCancel pressed!'
def OnConfigNext(self, event):
cmd_line_args = self._body.GetOptions()
# self.ShowArgumentErrorDlg(error)
if not self._model.IsValidArgString(cmd_line_args):
error_msg = self._model.GetErrorMsg(cmd_line_args)
print error_msg
else:
print 'All args passed.'
print cmd_line_args
def OnMainCancel(self, event):
print 'OnMaingCancel pressed!'

19
src/app/dialogs/model.py

@ -12,11 +12,6 @@ class ArgumentError(Exception):
class Model(object):
_instance = None
# def __new__(cls, *args, **kwargs):
# if not cls._instance:
# cls._instance = super(Model, cls).__new__(
# cls, *args, **kwargs)
# return cls._instance
def __init__(self, parser=None):
print parser
@ -32,7 +27,7 @@ class Model(object):
self._parser)
Model._instance = self
print self
def HasPositionals(self):
if self.action_groups._positionals:
return True
@ -55,7 +50,8 @@ class Model(object):
def _FormatMsg(self, msg):
output = list(msg)
output[output.index(':')] = ':\n '
if ':' in output:
output[output.index(':')] = ':\n '
return ''.join(output)
@staticmethod
@ -74,14 +70,7 @@ class Model(object):
if __name__ == '__main__':
import argparse_test_data
parser = argparse_test_data.parser
model = Model(parser)
b = model.GetInstance()
print model
print b
print model == b
pass
# print m2

BIN
src/app/images/image_store.pyc

Loading…
Cancel
Save