mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 11:30:19 +01:00
Added unit test for misc module, added initial mvc for main window.
This commit is contained in:
2
Makefile
2
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
|
||||
|
||||
|
||||
28
pygtktalog/controllers/main.py
Normal file
28
pygtktalog/controllers/main.py
Normal file
@@ -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
|
||||
13
pygtktalog/models/main.py
Normal file
13
pygtktalog/models/main.py
Normal file
@@ -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",)
|
||||
34
pygtktalog/views/main.py
Normal file
34
pygtktalog/views/main.py
Normal file
@@ -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
|
||||
|
||||
31
test/unit/misc_test.py
Normal file
31
test/unit/misc_test.py
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user