mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +01:00
* New version using pygtkmvc framework.
This commit is contained in:
3
mvc/src/__init__.py
Normal file
3
mvc/src/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
__all__ = ["models", "views", "controllers", "utils"]
|
||||
0
mvc/src/controllers/__init__.py
Normal file
0
mvc/src/controllers/__init__.py
Normal file
38
mvc/src/controllers/c_main.py
Normal file
38
mvc/src/controllers/c_main.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
|
||||
import utils._importer
|
||||
import utils.globals
|
||||
from gtkmvc import Controller
|
||||
import gtk
|
||||
|
||||
class MainController(Controller):
|
||||
"""Kontroler głównego okna aplikacji"""
|
||||
def __init__(self, model):
|
||||
Controller.__init__(self, model)
|
||||
return
|
||||
|
||||
def register_view(self, view):
|
||||
Controller.register_view(self, view)
|
||||
|
||||
# ustaw domyślne wartości dla poszczególnych widżetów
|
||||
self.view['main'].set_title('pyGTKtalog');
|
||||
self.view['main'].set_icon_list(gtk.gdk.pixbuf_new_from_file("pixmaps/mainicon.png"))
|
||||
|
||||
# pokaż główne okno
|
||||
self.view['main'].show();
|
||||
return
|
||||
|
||||
# Podłącz sygnały:
|
||||
def on_main_destroy_event(self, window, event):
|
||||
gtk.main_quit()
|
||||
return True
|
||||
|
||||
def on_tb_quit_clicked(self,toolbutton):
|
||||
gtk.main_quit()
|
||||
|
||||
def on_quit1_activate(self,button):
|
||||
gtk.main_quit()
|
||||
|
||||
# Obserwowalne właściwości
|
||||
|
||||
pass # end of class
|
||||
0
mvc/src/models/__init__.py
Normal file
0
mvc/src/models/__init__.py
Normal file
18
mvc/src/models/m_main.py
Normal file
18
mvc/src/models/m_main.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
|
||||
import utils._importer
|
||||
import utils.globals
|
||||
from gtkmvc import Model
|
||||
|
||||
class MainModel(Model):
|
||||
"""Our model contains a numeric counter and a numeric value that
|
||||
holds the value that the counter must be assigned to when we the
|
||||
model is reset"""
|
||||
|
||||
__properties__ = {}
|
||||
|
||||
def __init__(self):
|
||||
Model.__init__(self)
|
||||
return
|
||||
|
||||
pass # end of class
|
||||
3
mvc/src/utils/__init__.py
Normal file
3
mvc/src/utils/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
__all__ = ["globals", "_importer"]
|
||||
44
mvc/src/utils/_importer.py
Normal file
44
mvc/src/utils/_importer.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# Author: Roberto Cavada <cavada@irst.itc.it>
|
||||
#
|
||||
# Copyright (c) 2006 by Roberto Cavada
|
||||
#
|
||||
# pygtkmvc is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# pygtkmvc is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
#
|
||||
# For more information on pygtkmvc see <http://pygtkmvc.sourceforge.net>
|
||||
# or email to the author <cavada@irst.itc.it>.
|
||||
# Please report bugs to <cavada@irst.itc.it>.
|
||||
|
||||
|
||||
|
||||
# ======================================================================
|
||||
# This module is used only as a utility to import gtkmvc when not
|
||||
# installed.
|
||||
|
||||
import utils.globals
|
||||
|
||||
if __name__ != "__main__":
|
||||
try: import gtkmvc
|
||||
except:
|
||||
import os.path; import sys
|
||||
|
||||
rel_path = os.path.join(utils.globals.TOP_DIR, "..")
|
||||
top_dir = os.path.dirname(os.path.abspath(rel_path))
|
||||
sys.path = [top_dir] + sys.path
|
||||
import gtkmvc
|
||||
pass
|
||||
|
||||
gtkmvc.require("1.0.0")
|
||||
pass
|
||||
|
||||
33
mvc/src/utils/globals.py
Normal file
33
mvc/src/utils/globals.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# Author: Roberto Cavada <cavada@irst.itc.it>
|
||||
#
|
||||
# Copyright (c) 2006 by Roberto Cavada
|
||||
#
|
||||
# pygtkmvc is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# pygtkmvc is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||
#
|
||||
# For more information on pygtkmvc see <http://pygtkmvc.sourceforge.net>
|
||||
# or email to the author <cavada@irst.itc.it>.
|
||||
# Please report bugs to <cavada@irst.itc.it>.
|
||||
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
if sys.argv[0]: top_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||
else: top_dir = "."
|
||||
|
||||
|
||||
# A set of global vars
|
||||
TOP_DIR = top_dir
|
||||
GLADE_DIR = os.path.join(TOP_DIR, "glade")
|
||||
0
mvc/src/views/__init__.py
Normal file
0
mvc/src/views/__init__.py
Normal file
17
mvc/src/views/v_main.py
Normal file
17
mvc/src/views/v_main.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
|
||||
import utils._importer
|
||||
import utils.globals
|
||||
from gtkmvc import View
|
||||
import os.path
|
||||
|
||||
class MainView(View):
|
||||
"""This handles only the graphical representation of the
|
||||
application. The widgets set is loaded from glade file"""
|
||||
|
||||
GLADE = os.path.join(utils.globals.GLADE_DIR, "main.glade")
|
||||
def __init__(self, ctrl):
|
||||
View.__init__(self, ctrl, self.GLADE)
|
||||
return
|
||||
|
||||
pass # end of class
|
||||
Reference in New Issue
Block a user