From 9743d18b619267fc0fe829c7f5382a1eba563fc3 Mon Sep 17 00:00:00 2001 From: Chris Kiehl Date: Mon, 27 Jan 2014 00:51:34 -0500 Subject: [PATCH] Cleaned up unused code. --- src/app/dialogs/action_sorter_unittest.py | 2 +- src/app/dialogs/advanced_config_unittest.py | 5 ++- src/app/dialogs/client_runner.py | 11 ------ .../dialogs/component_register_unittest.py | 26 +++++++++++++ src/app/dialogs/controller.py | 1 - src/app/dialogs/footer.py | 13 ++++++- src/app/dialogs/footer.pyc | Bin 4993 -> 5261 bytes src/app/dialogs/option_reader.py | 5 +-- src/app/dialogs/option_reader_unittest.py | 35 ++++++++++++++++++ src/app/dialogs/parse_validator.py | 24 ------------ src/app/images/image_store.pyc | Bin 1206 -> 1206 bytes src/model/gooey.py | 21 ----------- 12 files changed, 78 insertions(+), 65 deletions(-) delete mode 100644 src/app/dialogs/client_runner.py create mode 100644 src/app/dialogs/component_register_unittest.py create mode 100644 src/app/dialogs/option_reader_unittest.py delete mode 100644 src/app/dialogs/parse_validator.py diff --git a/src/app/dialogs/action_sorter_unittest.py b/src/app/dialogs/action_sorter_unittest.py index 4f6d5ab..e5ad368 100644 --- a/src/app/dialogs/action_sorter_unittest.py +++ b/src/app/dialogs/action_sorter_unittest.py @@ -17,7 +17,7 @@ class TestActionSorter(unittest.TestCase): def setUp(self): self._actions = argparse_test_data.parser._actions self.sorted_actions = ActionSorter(self._actions) - # pain in the A... PEP8 be damned! + # pain in the A... self.expected_positionals = [ "_StoreAction(option_strings=[], dest='filename', nargs=None, const=None, default=None, type=None, choices=None, help='Name of the file you want to read', metavar=None)", '''_StoreAction(option_strings=[], dest='outfile', nargs=None, const=None, default=None, type=None, choices=None, help="Name of the file where you'll save the output", metavar=None)''' diff --git a/src/app/dialogs/advanced_config_unittest.py b/src/app/dialogs/advanced_config_unittest.py index 63f703b..60a2eee 100644 --- a/src/app/dialogs/advanced_config_unittest.py +++ b/src/app/dialogs/advanced_config_unittest.py @@ -11,6 +11,7 @@ import unittest import advanced_config import argparse_test_data from argparse import ArgumentParser +from config_model import Model class TestAdvancedConfigPanel(unittest.TestCase): @@ -21,8 +22,8 @@ class TestAdvancedConfigPanel(unittest.TestCase): app = wx.PySimpleApp() module_name = os.path.split(sys.argv[0])[-1] frame = wx.Frame(None, -1, module_name, size=(640,480)) - - panel = advanced_config.AdvancedConfigPanel(frame, self.parser) + + panel = advanced_config.AdvancedConfigPanel(frame, Model(self.parser)) frame.Show() app.MainLoop() diff --git a/src/app/dialogs/client_runner.py b/src/app/dialogs/client_runner.py deleted file mode 100644 index e8595a1..0000000 --- a/src/app/dialogs/client_runner.py +++ /dev/null @@ -1,11 +0,0 @@ -''' -Created on Jan 24, 2014 - -@author: Chris -''' - - - - -if __name__ == '__main__': - pass \ No newline at end of file diff --git a/src/app/dialogs/component_register_unittest.py b/src/app/dialogs/component_register_unittest.py new file mode 100644 index 0000000..082821d --- /dev/null +++ b/src/app/dialogs/component_register_unittest.py @@ -0,0 +1,26 @@ +''' +Created on Jan 26, 2014 + +@author: Chris +''' + +import unittest +from component_register import ComponentRegister + +class Test(unittest.TestCase): + + + def setUp(self): + class FakeClass(ComponentRegister): + def __init__(self): + pass + + self.test_class = FakeClass() + + def testHostClassReceivesMixinFunctions(self): + + + +if __name__ == "__main__": + #import sys;sys.argv = ['', 'Test.testName'] + unittest.main() \ No newline at end of file diff --git a/src/app/dialogs/controller.py b/src/app/dialogs/controller.py index 8347de4..13108c9 100644 --- a/src/app/dialogs/controller.py +++ b/src/app/dialogs/controller.py @@ -65,7 +65,6 @@ class Controller(object): def OnCancelRunButton(self, event): pass - def RunClientCode(self): pool = Pool(1) try: diff --git a/src/app/dialogs/footer.py b/src/app/dialogs/footer.py index 7ed097b..5b863e6 100644 --- a/src/app/dialogs/footer.py +++ b/src/app/dialogs/footer.py @@ -5,6 +5,7 @@ Created on Dec 23, 2013 ''' import wx +from app.images import image_store class AbstractFooter(wx.Panel): ''' @@ -20,10 +21,20 @@ class AbstractFooter(wx.Panel): self._do_layout() def _init_components(self): + ''' + initialize all of the components used in the footer + TODO: + Add Checkmark image for when the program has finished running. + Refactor image tools into their own module. The resize code is + getting spread around a bit. + ''' self.cancel_button = self._Button('Cancel', wx.ID_CANCEL) self.start_button = self._Button("Start", wx.ID_OK) self.cancel_run_button = self._Button('Cancel', wx.ID_CANCEL) +# _bitmap = wx.Bitmap(image_store.alessandro_rei_checkmark) +# wx.StaticBitmap(self, -1, _bitmap) + def _do_layout(self): v_sizer = wx.BoxSizer(wx.VERTICAL) h_sizer = wx.BoxSizer(wx.HORIZONTAL) @@ -54,7 +65,7 @@ class AbstractFooter(wx.Panel): def NextPage(self): self.cancel_button.Hide() self.start_button.Hide() - self.cancel_run_button.Show() +# self.cancel_run_button.Show() self.Layout() diff --git a/src/app/dialogs/footer.pyc b/src/app/dialogs/footer.pyc index 2f7f22bfdd72ab9e42faed98b06b1f4c28548b2c..a1d73b71a352742752a2356471c4248b7c2e343c 100644 GIT binary patch delta 1231 zcmah|Nlz3(6t3!-?pc_HVKZQYMO+wS1W}O01S4XC3jr-KhDne#(=|*>PuJL8BS8;@ z=v5Of|9}S*uSz_b_#3=?_Mk^S84vni4d}sxlc}#?zk18}mfjtHGP0BSp3mO=_L*17 z{x1Q~i*Vvi0FRIgASIqf0!k_%z&}9(i!>6Xk|5Me5<$t`B&orLO&$~Sh>(?vO+1GP z+h|jNv<~so2ilC$=Fm8W;g`zUXAh@(%M{Y84gkO5Ziuy5$w<6;o3!jC=nDG1b#EsD z#`qS00mx=De&{RT4g3d!xk12Wjj6g|RoQ6DP=qRGtyp->4~@Der4kW%EiYbPJkLPL z%y=G~t&8er!;LnX$;)aoVq105_Gw0PBXS$8?#8Uw;mqcchG9ZsI4 z)Y5bIHC6(J>GaI})wzW=es%83vWaUX-mTx*BeX|ev!J>i4-}Sm(h`D^^epxn+7q)VG>%TRUH1onZ=v3 zex5!$0V_p4sMjpVf|)%>_Iwbb8^F+*ceiCr86${JyO#9rOujgSaZL3zPxF>;WyS_D zA;;EmtjUn#NR*fLhs>Q`q=0qA1pp`EP*{@U-gx#E?ZGRK?h4_OA9~R4uN^07Ntbec zlZFdYTMS`RFeu&%_ovbW+BS95B3yAkjF2;ZGL-bY+>L(Ir*XJ3DV8?<=0U>-^Xqg) z@8;)wjm=r~o&Y$we_2?uQMvlp=FGn~tJKxM3PUuhhl&BcviGzY(}6#AwVQ!;@G%5S zA1)0HU`hWWFZJuv<@S)L(0YH!$O+%?>q^%V$5c6`PZw9F&w;WA$IQk_Lz7cwGm=xF k?YYHP10&tOe?L;wxZR3=tzPC{q$YbVR-5E zdyAg_V}b@il@Ot!K^vh;h7L`HmIhDAHsBE86~Lpa4h<8Uy7F45UIQAD6R&;hHMv{G zcleNZZx=s*H8hh?b>*@4>>5yr-%5c+c&FB>H`{?pW+kXS5BvyO0mJ6XZV+@k0%gyr zq9aT8Mw0zw^z^wDaB#)Egov_g-JeX6BZv{)F0K|zn_{(aZ$q_JmPpGl)+}b^4{L&Y zB_eIprrdM#AX3Mu{1#c8L~g)+!*dl!!83>{hG`~XCdizVAM6Jy&J;}B*VuAo+}Xzk z`P#|hvOIF8$}NMH!xsQ8Q(2^S#phE>zA9$M;ygo|Awv)t1eK@VJw>Eg+wblMs)YKN z?20T$-I42*(r5C3uDaz;bbgu@6)cb7kRm3StjIIW5%|CpjFJUvGaR*a3mwNX2l?0$ zW;rCdk)pA(-D!~c$MKo7N?Vr#<&Ij?a5HI{b3KoF`^-BOE6UakLrf{g{R;AKik`|@#5KCe_B9 zgTquGJ<1O!3ZvHao^Oqo0ImlQxi1XeoEv}6(jphCT8-$X+ diff --git a/src/app/dialogs/option_reader.py b/src/app/dialogs/option_reader.py index 9e38f37..6bcdf20 100644 --- a/src/app/dialogs/option_reader.py +++ b/src/app/dialogs/option_reader.py @@ -13,13 +13,10 @@ class OptionReader(object): ''' __metaclass__ = ABCMeta - def __init__(self): - pass - @abstractmethod def GetOptions(self): ''' Implemented by subclasses. - Defines how the config panels read their options + Defines how the config panel Views retrieve their options ''' pass \ No newline at end of file diff --git a/src/app/dialogs/option_reader_unittest.py b/src/app/dialogs/option_reader_unittest.py new file mode 100644 index 0000000..272d6b6 --- /dev/null +++ b/src/app/dialogs/option_reader_unittest.py @@ -0,0 +1,35 @@ +''' +Created on Jan 26, 2014 + +@author: Chris +''' + +import types +import unittest +from option_reader import OptionReader + + +class FakeClass(OptionReader): + def __init__(self): + pass + +class FakeClassWithImplementation(OptionReader): + def __init__(self): + pass + def GetOptions(self): + pass + + +class Test(unittest.TestCase): + + def test_mixin_classes_throws_typeerror_without_implementation(self): + with self.assertRaises(TypeError): + fake_class = FakeClass() + + def test_mixin_classes_passes_with_implementation(self): + fc = FakeClassWithImplementation() + + +if __name__ == "__main__": + #import sys;sys.argv = ['', 'Test.testName'] + unittest.main() \ No newline at end of file diff --git a/src/app/dialogs/parse_validator.py b/src/app/dialogs/parse_validator.py deleted file mode 100644 index 812ff56..0000000 --- a/src/app/dialogs/parse_validator.py +++ /dev/null @@ -1,24 +0,0 @@ -''' -Created on Jan 22, 2014 - -@author: Chris -''' - -import types -from argparse import ArgumentParser - - - - - - - - -def validate(parser, arg_string): - parser.error = types.MethodType(RaiseError, parser) - parser.parse_args(arg_string.split()) - - - -if __name__ == '__main__': - pass \ No newline at end of file diff --git a/src/app/images/image_store.pyc b/src/app/images/image_store.pyc index 82d410a008e3fcda681f04b54a85dcdb860b2413..d0fce9d773f49db6ba6e160471944346534027e8 100644 GIT binary patch delta 15 XcmdnSxs8*J`7wy+ diff --git a/src/model/gooey.py b/src/model/gooey.py index 3c45f89..b0cc931 100644 --- a/src/model/gooey.py +++ b/src/model/gooey.py @@ -25,31 +25,10 @@ def Gooey(f=None, advanced=True, language='english'): Launched ''' -# print locals() - - # Handles if the passed in object is instance - # of ArgumentParser. If so, it's being called as - # a function, rather than a decorator -# if isinstance(f, argparse.ArgumentParser): -# progname = sys.argv[0] -# -# build_doc_from_parser_obj( -# file_name=progname, -# parser_obj=f, -# format=format, -# noob=noob, -# success_msg=success_msg -# ) -# return - - # --------------------------------- # - # Below code is all decorator stuff # - # --------------------------------- # def build(f): def inner(): module_path = get_caller_path() parser = source_parser.extract_parser(module_path) - print 'parser in inner', parser i18n = I18N(language) if not parser: print 'shit fuck!'