mirror of
https://github.com/gryf/pygtktalog.git
synced 2025-12-17 19:40:21 +01:00
* Fixed bug with no-displayed preferences window.
This commit is contained in:
@@ -17,13 +17,15 @@ class ConfigController(Controller):
|
|||||||
|
|
||||||
def register_view(self, view):
|
def register_view(self, view):
|
||||||
Controller.register_view(self, view)
|
Controller.register_view(self, view)
|
||||||
|
|
||||||
|
self.view['config'].show();
|
||||||
return
|
return
|
||||||
# Podłącz sygnały:
|
# Podłącz sygnały:
|
||||||
# Obserwowalne właściwości
|
# Obserwowalne właściwości
|
||||||
# funkcje obsługi formularza
|
# funkcje obsługi formularza
|
||||||
pass # end of class
|
pass # end of class
|
||||||
|
|
||||||
|
'''
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@@ -176,3 +178,4 @@ if __name__ == "__main__":
|
|||||||
gtk.main()
|
gtk.main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
gtk.main_quit
|
gtk.main_quit
|
||||||
|
'''
|
||||||
|
|||||||
@@ -1,20 +1,30 @@
|
|||||||
# This Python file uses the following encoding: utf-8
|
# This Python file uses the following encoding: utf-8
|
||||||
|
|
||||||
|
__version__ = "0.6"
|
||||||
|
licence = \
|
||||||
|
"""
|
||||||
|
GPL v2
|
||||||
|
http://www.gnu.org/licenses/gpl.txt
|
||||||
|
"""
|
||||||
|
|
||||||
import utils._importer
|
import utils._importer
|
||||||
import utils.globals
|
import utils.globals
|
||||||
from gtkmvc import Controller
|
from gtkmvc import Controller
|
||||||
from models.m_config import ConfigModel
|
|
||||||
|
from controllers.c_config import ConfigController
|
||||||
|
from views.v_config import ConfigView
|
||||||
|
|
||||||
import views.v_dialogs as Dialogs
|
import views.v_dialogs as Dialogs
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
class MainController(Controller):
|
class MainController(Controller):
|
||||||
"""Kontroler głównego okna aplikacji"""
|
"""Kontroler głównego okna aplikacji"""
|
||||||
db_tmp_filename = None
|
db_tmp_filename = None
|
||||||
conf = ConfigModel()
|
|
||||||
unsaved_project = False
|
unsaved_project = False
|
||||||
|
|
||||||
def __init__(self, model):
|
def __init__(self, model):
|
||||||
Controller.__init__(self, model)
|
Controller.__init__(self, model)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def register_view(self, view):
|
def register_view(self, view):
|
||||||
@@ -35,20 +45,20 @@ class MainController(Controller):
|
|||||||
self.view['details'].hide()
|
self.view['details'].hide()
|
||||||
|
|
||||||
# załaduj konfigurację/domyślne ustawienia i przypisz je właściwościom
|
# załaduj konfigurację/domyślne ustawienia i przypisz je właściwościom
|
||||||
self.conf.load()
|
|
||||||
self.view['toolbar1'].set_active(self.conf.confd['showtoolbar'])
|
self.view['toolbar1'].set_active(self.model.config.confd['showtoolbar'])
|
||||||
if self.conf.confd['showtoolbar']:
|
if self.model.config.confd['showtoolbar']:
|
||||||
self.view['maintoolbar'].show()
|
self.view['maintoolbar'].show()
|
||||||
else:
|
else:
|
||||||
self.view['maintoolbar'].hide()
|
self.view['maintoolbar'].hide()
|
||||||
self.view['status_bar1'].set_active(self.conf.confd['showstatusbar'])
|
self.view['status_bar1'].set_active(self.model.config.confd['showstatusbar'])
|
||||||
if self.conf.confd['showstatusbar']:
|
if self.model.config.confd['showstatusbar']:
|
||||||
self.view['statusprogress'].show()
|
self.view['statusprogress'].show()
|
||||||
else:
|
else:
|
||||||
self.view['statusprogress'].hide()
|
self.view['statusprogress'].hide()
|
||||||
self.view['hpaned1'].set_position(self.conf.confd['h'])
|
self.view['hpaned1'].set_position(self.model.config.confd['h'])
|
||||||
self.view['vpaned1'].set_position(self.conf.confd['v'])
|
self.view['vpaned1'].set_position(self.model.config.confd['v'])
|
||||||
self.view['main'].resize(self.conf.confd['wx'],self.conf.confd['wy'])
|
self.view['main'].resize(self.model.config.confd['wx'],self.model.config.confd['wy'])
|
||||||
|
|
||||||
# zainicjalizuj statusbar
|
# zainicjalizuj statusbar
|
||||||
ContextID = self.view['mainStatus'].get_context_id('detailed res')
|
ContextID = self.view['mainStatus'].get_context_id('detailed res')
|
||||||
@@ -85,10 +95,14 @@ class MainController(Controller):
|
|||||||
self.addDirectory()
|
self.addDirectory()
|
||||||
|
|
||||||
def on_about1_activate(self,widget):
|
def on_about1_activate(self,widget):
|
||||||
self.about()
|
Dialogs.Abt("pyGTKtalog", __version__, "About", ["Roman 'gryf' Dobosz"], licence)
|
||||||
|
return
|
||||||
|
|
||||||
def on_properties1_activate(self,widget):
|
def on_preferences_activate(self,widget):
|
||||||
self.preferences()
|
print 'aaa'
|
||||||
|
c = ConfigController(self.model.config)
|
||||||
|
v = ConfigView(c)
|
||||||
|
return
|
||||||
|
|
||||||
def on_status_bar1_activate(self,widget):
|
def on_status_bar1_activate(self,widget):
|
||||||
self.toggle_status_bar()
|
self.toggle_status_bar()
|
||||||
@@ -132,7 +146,7 @@ class MainController(Controller):
|
|||||||
#{{{
|
#{{{
|
||||||
# check if any unsaved project is on go.
|
# check if any unsaved project is on go.
|
||||||
if self.unsaved_project:
|
if self.unsaved_project:
|
||||||
if self.conf.confd['confirmquit']:
|
if self.model.config.confd['confirmquit']:
|
||||||
obj = Dialogs.Qst('Quit application - pyGTKtalog','There is not saved database\nDo you really want to quit?')
|
obj = Dialogs.Qst('Quit application - pyGTKtalog','There is not saved database\nDo you really want to quit?')
|
||||||
if not obj.run():
|
if not obj.run():
|
||||||
return
|
return
|
||||||
@@ -147,11 +161,11 @@ class MainController(Controller):
|
|||||||
|
|
||||||
def storeSettings(self):
|
def storeSettings(self):
|
||||||
"""Store window size and pane position in config file (using config object)"""
|
"""Store window size and pane position in config file (using config object)"""
|
||||||
if self.conf.confd['savewin']:
|
if self.model.config.confd['savewin']:
|
||||||
self.conf.confd['wx'], self.conf.confd['wy'] = self.view['main'].get_size()
|
self.model.config.confd['wx'], self.model.config.confd['wy'] = self.view['main'].get_size()
|
||||||
if self.conf.confd['savepan']:
|
if self.model.config.confd['savepan']:
|
||||||
self.conf.confd['h'],self.conf.confd['v'] = self.view['hpaned1'].get_position(), self.view['vpaned1'].get_position()
|
self.model.config.confd['h'],self.model.config.confd['v'] = self.view['hpaned1'].get_position(), self.view['vpaned1'].get_position()
|
||||||
self.conf.save()
|
self.model.config.save()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def newDB(self):
|
def newDB(self):
|
||||||
@@ -166,6 +180,9 @@ class MainController(Controller):
|
|||||||
def toggle_toolbar(self):
|
def toggle_toolbar(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def toggle_status_bar(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
# This Python file uses the following encoding: utf-8
|
# This Python file uses the following encoding: utf-8
|
||||||
|
import utils._importer
|
||||||
|
import utils.globals
|
||||||
|
from gtkmvc import Model
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
class Ini(object):
|
class Ini(object):
|
||||||
@@ -22,9 +27,11 @@ class Ini(object):
|
|||||||
def show(self):
|
def show(self):
|
||||||
return "\n".join(self.ini)
|
return "\n".join(self.ini)
|
||||||
|
|
||||||
class ConfigModel(object):
|
class ConfigModel(Model):
|
||||||
ini = Ini()
|
ini = Ini()
|
||||||
|
|
||||||
|
__properties__ = {}
|
||||||
|
|
||||||
confd = {
|
confd = {
|
||||||
'savewin' : True,
|
'savewin' : True,
|
||||||
'savepan' : True,
|
'savepan' : True,
|
||||||
@@ -87,7 +94,7 @@ class ConfigModel(object):
|
|||||||
path = "/tmp"
|
path = "/tmp"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
Model.__init__(self)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import utils._importer
|
|||||||
import utils.globals
|
import utils.globals
|
||||||
from gtkmvc import Model
|
from gtkmvc import Model
|
||||||
|
|
||||||
|
from models.m_config import ConfigModel
|
||||||
|
|
||||||
class MainModel(Model):
|
class MainModel(Model):
|
||||||
"""Our model contains a numeric counter and a numeric value that
|
"""Our model contains a numeric counter and a numeric value that
|
||||||
holds the value that the counter must be assigned to when we the
|
holds the value that the counter must be assigned to when we the
|
||||||
@@ -13,6 +15,8 @@ class MainModel(Model):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Model.__init__(self)
|
Model.__init__(self)
|
||||||
|
self.config = ConfigModel()
|
||||||
|
self.config.load()
|
||||||
return
|
return
|
||||||
|
|
||||||
pass # end of class
|
pass # end of class
|
||||||
|
|||||||
Reference in New Issue
Block a user