Skip to content

Instantly share code, notes, and snippets.

@Eugeny
Created March 17, 2010 18:26
Show Gist options
  • Save Eugeny/335556 to your computer and use it in GitHub Desktop.
Save Eugeny/335556 to your computer and use it in GitHub Desktop.
diff --git a/plugins/apache/30-apache.py b/plugins/apache/30-apache.py
index 80e48e2..4dec139 100755
--- a/plugins/apache/30-apache.py
+++ b/plugins/apache/30-apache.py
@@ -73,6 +73,7 @@ class ApachePluginInstance(PluginInstance):
self._edit_apache_modules.btnOK.tag = 'modules'
self._edit_apache_modules.btnOK.handler = self.back_button_clicked
+ self._edit_apache_modules.session = self.session # This can be somewhere else already (but I haven't found it)
self._edit_apache_modules.openConfigDialog = self.open_module_config
def build_panel(self):
@@ -317,11 +318,11 @@ class ApacheModule():
self.save()
return
- def open_config_dialog(self,t,e,d):
- confd = EditApacheModuleConfig()
- session.switch.switch( confd )
- self.config_dialog = confd
- return
+ #def open_config_dialog(self,t,e,d):
+ # confd = EditApacheModuleConfig()
+ # session.switch.switch( confd )
+ # self.config_dialog = confd
+ # return
class ApacheModules():
modules = None
@@ -337,20 +338,29 @@ class ApacheModules():
return
class EditApacheModuleConfig(ui.DialogBox):
+ parent = None
+
def __init__(self):
ui.DialogBox.__init__(self)
self.lblTitle.text = 'Apache Module configuration'
self.width = "auto"
self.visible = False
-
-
+
ta = ui.TextArea( '' )
ta.width = 300
ta.height = 300
-
+
+ parent = None
+ self.btnCancel.handler = self.btn_clicked
+ self.btnOK.handler = self.btn_clicked
self.inner = ta
+ def customize(self, module):
+ self.inner.text = 'Configuration stuff for ' + module
+
def btn_clicked(self,t,e,d):
+ if t == self.btnCancel:
+ self.parent.session.core.switch.switch(self.parent)
print self.inner.text
return
@@ -381,7 +391,8 @@ class EditApacheModulesDialog(ui.DialogBox):
name = None
if m.hasConfig:
name = ui.Link(m.name)
- name.handler = m.open_config_dialog
+ #name.handler = m.open_config_dialog
+ name.handler = self._on_module_clicked
name.tag = m.name
else:
name = ui.Label(m.name)
@@ -400,6 +411,18 @@ class EditApacheModulesDialog(ui.DialogBox):
self.inner = t
self.tab = t
+ def _on_module_clicked(self, t, e, d):
+ if e == 'click':
+ print 'asd'
+ n = t.tag
+ confd = EditApacheModuleConfig()
+ confd.customize(n)
+ confd.parent = self
+ self.session.register_panel(confd)
+ self.session.core.switch.switch(confd)
+
+
+
class InstallAction(tools.Action):
name = 'install'
plugin = 'apache'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment