diff --git a/Makefile b/Makefile index a8e931a..9e40eb2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -RUN = PYTHONPATH=/home/gryf/Devel/Python/pyGTKtalog2:/home/gryf/.python_lib python +RUN = PYTHONPATH=/home/gryf/Devel/Python/pyGTKtalog:/home/gryf/.python_lib python LOCALE = LC_ALL=pl_PL.utf8 FILE = pygtktalog.py diff --git a/pygtktalog/controllers/main.py b/pygtktalog/controllers/main.py new file mode 100644 index 0000000..e7f4349 --- /dev/null +++ b/pygtktalog/controllers/main.py @@ -0,0 +1,28 @@ +""" + Project: pyGTKtalog + Description: Controller for main window + Type: core + Author: Roman 'gryf' Dobosz, gryf73@gmail.com + Created: 2009-05-02 +""" +from gtkmvc import Controller + + +class MainController(Controller): + """ + Controller for main application window + """ + + def __init__(self, model, view): + """Initialize main controller""" + Controller.__init__(self, model, view) + + def register_view(self, view): + """Default view registration stuff""" + view['main'].show() + + def register_adapters(self): + """ + progress bar/status bar adapters goes here + """ + pass diff --git a/pygtktalog/models/main.py b/pygtktalog/models/main.py new file mode 100644 index 0000000..f5f08af --- /dev/null +++ b/pygtktalog/models/main.py @@ -0,0 +1,13 @@ +""" + Project: pyGTKtalog + Description: Model for main application + Type: core + Author: Roman 'gryf' Dobosz, gryf73@gmail.com + Created: 2009-05-02 +""" +from gtkmvc import Model + +class MainModel(Model): + status_bar_message = _("Idle") + + __observables__ = ("status_bar_message",) diff --git a/pygtktalog/views/main.py b/pygtktalog/views/main.py new file mode 100644 index 0000000..a007d77 --- /dev/null +++ b/pygtktalog/views/main.py @@ -0,0 +1,34 @@ +""" + Project: pyGTKtalog + Description: View for main window + Type: core + Author: Roman 'gryf' Dobosz, gryf73@gmail.com + Created: 2009-05-02 +""" +import os.path +import gtk +from gtkmvc import View + + +class MainView(View): + """ + Create window from glade file. Note, that glade file is placed in view + module under glade subdirectory. + """ + + glade = os.path.join(os.path.dirname(__file__), "glade", "main.glade") + top = "main" + + def __init__(self): + """ + Initialize view + """ + View.__init__(self) + self['tag_path_box'].hide() + + def set_widgets_scan_visibility(self, flag): + """ + Activate/deactivate selected widgets while scanning is active + """ + pass + diff --git a/test/unit/misc_test.py b/test/unit/misc_test.py new file mode 100644 index 0000000..3f06f55 --- /dev/null +++ b/test/unit/misc_test.py @@ -0,0 +1,31 @@ +""" + Project: pyGTKtalog + Description: Tests for misc functions. + Type: test + Author: Roman 'gryf' Dobosz, gryf73@gmail.com + Created: 2009-04-09 +""" +import unittest +import os +import pygtktalog.misc as pgtkmisc + +class TestMiscModule(unittest.TestCase): + """ + Tests functions from misc module + """ + + def test_float_to_string(self): + """ + test conversion between digits to formated output + """ + self.assertEqual(pgtkmisc.float_to_string(10), '00:00:10') + self.assertEqual(pgtkmisc.float_to_string(76), '00:01:16') + self.assertEqual(pgtkmisc.float_to_string(22222), '06:10:22') + self.assertRaises(TypeError, pgtkmisc.float_to_string) + self.assertRaises(TypeError, pgtkmisc.float_to_string, None) + self.assertRaises(TypeError, pgtkmisc.float_to_string, '10') + +if __name__ == "__main__": + os.chdir(os.path.join(os.path.abspath(os.path.dirname(__file__)), "../")) + print os.path.abspath(os.path.curdir) + unittest.main()