Permalink
Browse files

Changed kde control model to use QDeclarativeView class and make it c…

…hild of QVBoxLayout to expand correctly
  • Loading branch information...
1 parent 95e2a86 commit 83b1f22d03fd65cd3d2f6ad606917211041927fd Wiliam Souza committed Apr 29, 2011
Showing with 23 additions and 70 deletions.
  1. +12 −40 kcm/mcc2-services.py
  2. +11 −30 kcm/mcc2-users.py
View
@@ -1,53 +1,25 @@
#!/usr/bin/env python
+
import sys
sys.path.append('/usr/share/mandriva/')
-from PyQt4 import QtGui, QtCore, QtDeclarative
+from PyQt4 import QtGui
+
+#from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
+from PyKDE4.kdeui import KCModule
-from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
-from PyKDE4.kdeui import KApplication, KMainWindow, KCModule
+from mcc2.frontends.services.services import SystemServicesView
-from mcc2.frontends.services.models import ServiceModel
-from mcc2.frontends.services.proxy import ProxyServiceModel
-from mcc2.frontends.services.controllers import Controller
+class SystemServicesModule(KCModule):
-class ServicesModule(KCModule):
def __init__(self, component_data, parent):
KCModule.__init__(self, component_data, parent)
+
+ self.vbox = QtGui.QVBoxLayout(self)
+ self.view = SystemServicesView(self)
+ self.vbox.addWidget(self.view)
- self.view = QtDeclarative.QDeclarativeView(self)
-
- self.proxyServiceModel = ProxyServiceModel(parent=self)
- self.serviceModel = ServiceModel(self.proxyServiceModel)
- self.serviceModel.populate()
- self.proxyServiceModel.setSourceModel(self.serviceModel)
-
- self.controller = Controller(self)
-
- self.context = self.view.rootContext()
- self.context.setContextProperty('controller', self.controller)
- self.context.setContextProperty('serviceModel', self.proxyServiceModel)
-
- self.view.setSource(QtCore.QUrl('/usr/share/mandriva/mcc2/frontends/services/views/SystemServices.qml'))
- self.view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
- self.view.setWindowTitle('Mandriva Control Center - System Services')
-
- #self.connect(self.view, QtCore.SIGNAL("clientClosed()"), self.onClose)
- #self.connect(self.view, QtCore.SIGNAL("clientIsEmbedded()"), self.isLoaded)
-
- """
- def onClose(self):
- print "*"*80
- print "onClose"
- self.view.destroy()
-
- def isLoaded(self):
- print "*"*80
- print "isLoaded"
- self.view.setFocus()
- self.view.adjustSize()
- """
def CreatePlugin(widget_parent, parent, component_data):
- return ServicesModule(component_data, parent)
+ return SystemServicesModule(component_data, parent)
View
@@ -1,44 +1,25 @@
#!/usr/bin/env python
+
import sys
sys.path.append('/usr/share/mandriva/')
-from PyQt4 import QtGui, QtCore, QtDeclarative
+from PyQt4 import QtGui
+
+#from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
+from PyKDE4.kdeui import KCModule
-from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
-from PyKDE4.kdeui import KApplication, KMainWindow, KCModule
+from mcc2.frontends.users.users import UsersView
-from mcc2.frontends.users.models import UserModel, SystemUserModel, GroupModel, SystemGroupModel
-from mcc2.frontends.users.controllers import Controller
+class UsersModule(KCModule):
-class ServicesModule(KCModule):
def __init__(self, component_data, parent):
KCModule.__init__(self, component_data, parent)
- self.view = QtDeclarative.QDeclarativeView(self)
-
- self.userModel = UserModel(self.view)
- self.userModel.populate()
- self.systemUserModel = SystemUserModel(self.view)
- self.systemUserModel.populate()
- self.groupModel = GroupModel(self.view)
- self.groupModel.populate()
- self.systemGroupModel = SystemGroupModel(self.view)
- self.systemGroupModel.populate()
-
- self.controller = Controller(self.view)
-
- self.context = self.view.rootContext()
- self.context.setContextProperty('groupModel', self.groupModel)
- self.context.setContextProperty('systemGroupModel', self.systemGroupModel)
- self.context.setContextProperty('userModel', self.userModel)
- self.context.setContextProperty('systemUserModel', self.systemUserModel)
- self.context.setContextProperty('controller', self.controller)
-
- self.view.setSource(QtCore.QUrl('/usr/share/mandriva/mcc2/frontends/users/views/UsersAndGroups.qml'))
- #view.setResizeMode(QtDeclarative.QDeclarativeView.SizeRootObjectToView)
- self.view.setWindowTitle('Mandriva Control Center - Users and Groups')
+ self.vbox = QtGui.QVBoxLayout(self)
+ self.view = UsersView(self)
+ self.vbox.addWidget(self.view)
def CreatePlugin(widget_parent, parent, component_data):
- return ServicesModule(component_data, parent)
+ return UsersModule(component_data, parent)

0 comments on commit 83b1f22

Please sign in to comment.