[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2868] Finishing MIME types selection.
From: |
Ignacy Moryc |
Subject: |
[myserver-commit] [2868] Finishing MIME types selection. |
Date: |
Sun, 05 Oct 2008 09:47:51 +0000 |
Revision: 2868
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2868
Author: ignacy
Date: 2008-10-05 09:47:50 +0000 (Sun, 05 Oct 2008)
Log Message:
-----------
Finishing MIME types selection. Design updates
Modified Paths:
--------------
trunk/misc/PyGTK_Control/ConfigGUI.py
trunk/misc/PyGTK_Control/XMLGui.glade
Modified: trunk/misc/PyGTK_Control/ConfigGUI.py
===================================================================
--- trunk/misc/PyGTK_Control/ConfigGUI.py 2008-10-04 22:21:15 UTC (rev
2867)
+++ trunk/misc/PyGTK_Control/ConfigGUI.py 2008-10-05 09:47:50 UTC (rev
2868)
@@ -4,12 +4,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program 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 General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -37,7 +37,7 @@
# Connect the Glade file
self.gladefile = "XMLGui.glade"
self.wTree = gtk.glade.XML(self.gladefile)
-
+
# Bind main window
self.window = self.wTree.get_widget("ConfigUI")
# Bind "destroy" event
@@ -55,7 +55,7 @@
column.set_resizable(True)
self.treeview.append_column(column)
renderer=gtk.CellRendererText()
-
+
# Add list items to tree view
self.insert_row(self.treemodel,None,'default.html')
self.insert_row(self.treemodel,None,'default.htm')
@@ -63,9 +63,38 @@
self.insert_row(self.treemodel,None,'index.html')
self.insert_row(self.treemodel,None,'index.htm')
self.insert_row(self.treemodel,None,'index.php')
-
+
self.treeview.show()
+ self.store2 = gtk.ListStore(gobject.TYPE_STRING)
+ #populate
+ self.store2.append(["Every HTTP connection"])
+ self.store2.append(["FTP connection"])
+ self.cbHost=self.wTree.get_widget("combobox5")
+ self.cbHost.set_model(self.store2)
+ cell = gtk.CellRendererText()
+ self.cbHost.pack_start(cell, True)
+ self.cbHost.add_attribute(cell, 'text',0)
+
+ # Add list items to tree view
+ # this types are parsed from xml file using helper class MIMEtpe
+ # the result is used to poulate the treeview and the combobox
+
+ from MIMEtypes import MIMEtype, ParseTypes
+ TYPES = ParseTypes("MIMEtypes.xml")
+
+ #Create combobox to select MIME type
+ # http://faq.pygtk.org/index.py?req=show&file=faq16.008.htp
+ self.comboboxMIME = self.wTree.get_widget("combobox3")
+ self.store = gtk.ListStore(gobject.TYPE_STRING)
+ #populate
+ for element in TYPES:
+ self.store.append([str(element.MIME)])
+ self.comboboxMIME.set_model(self.store)
+ cell = gtk.CellRendererText()
+ self.comboboxMIME.pack_start(cell, True)
+ self.comboboxMIME.add_attribute(cell, 'text',0)
+
# Crete treeview widget with file extensions
self.treeviewEXT=self.wTree.get_widget("treeview2")
self.treemodelEXT=gtk.TreeStore(gobject.TYPE_STRING)
@@ -77,18 +106,13 @@
column.set_resizable(True)
self.treeviewEXT.append_column(column)
renderer=gtk.CellRendererText()
-
- # Add list items to tree view
- # this types are parsed from xml file using helper class MIMEtpe
- from MIMEtypes import MIMEtype, ParseTypes
- TYPES = ParseTypes("MIMEtypes.xml")
-
+
#populate
for element in TYPES:
self.insert_row(self.treemodelEXT,None,element.ext)
self.treeviewEXT.show()
-
+
# dic - dictionary with pairs:
# "signal name" : event
dic = { "on_btnAddFileName_clicked" : \
@@ -97,12 +121,18 @@
self.buttonRemoveDefultFileName_clicked,
"on_btnAddMIMEExtenesion_clicked" : \
self.buttonAddMIMEExtension_clicked,
+ "on_btnAddMIMEType_clicked" : \
+ self.buttonAddMIMEType_clicked,
"on_filechooserbutton2_file_set" : \
self.filechooserbutton2_file_set,
"on_filechooserbutton1_file_set" : \
self.filechooserbutton1_file_set,
"on_btnRemoveMIMEExtension_clicked" : \
- self.buttonRemoveMIMEExtension_clicked
+ self.buttonRemoveMIMEExtension_clicked,
+ "on_btnAddHostName_clicked" : \
+ self.buttonAddHostName_clicked,
+ "on_btnRemoveHostName_clicked" : \
+ self.buttonRemoveHostName_clicked
}
# Connect signals
self.wTree.signal_autoconnect (dic)
@@ -126,30 +156,45 @@
model, selected = selection.get_selected()
model.remove(selected)
+ def buttonAddMIMEType_clicked(self, button):
+ """ Add new MIME type to list """
+ self.store.append([self.ShowDialogBox("Add new MIME type")])
+
+ def buttonAddHostName_clicked(self, button):
+ """ Add new Host name to combobox """
+ self.store2.append([self.ShowDialogBox("Add new host")])
+
+ def buttonRemoveHostName_clicked(self, button):
+ """ Removes host name from combobox """
+ self.store2.remove(self.cbHost.get_active_iter())
+
def buttonAddefaultFileName_clicked(self, button):
""" Adds new entry, with default file name to tree view"""
- dia = gtk.Dialog("Add new file name")
- dia.show()
- entry = gtk.Entry()
- entry.show()
- entry.set_activates_default(True)
- dia.vbox.pack_start(entry)
- dia.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
- dia.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
- dia.set_default_response(gtk.RESPONSE_OK)
- response = dia.run()
- if response == gtk.RESPONSE_OK:
- name = entry.get_text()
- dia.destroy()
- self.insert_row(self.treemodel,None, name)
-
+ self.insert_row(self.treemodel,None, self.ShowDialogBox("Add new file
name"))
+
def buttonRemoveDefultFileName_clicked(self, button):
""" Removes selected file name """
self.delete_rows(self.treeview)
-
+
def buttonAddMIMEExtension_clicked(self, button):
""" Add new extension """
- dia = gtk.Dialog("Add new extension")
+ self.insert_row(self.treemodelEXT,None, self.ShowDialogBox("Add new
extension"))
+
+ def buttonRemoveMIMEExtension_clicked(self, widget):
+ """ Remove selected extension name """
+ self.delete_rows(self.treeviewEXT)
+
+ def filechooserbutton2_file_set(self, widget):
+ """ Place file path in entry field """
+
self.wTree.get_widget("enManager").set_text(self.wTree.get_widget("filechooserbutton2").get_filename())
+
+ def filechooserbutton1_file_set(self, widget):
+ """ Place file path in entry field """
+
self.wTree.get_widget("enStylesheet").set_text(self.wTree.get_widget("filechooserbutton1").get_filename())
+
+ def ShowDialogBox(self, title):
+ """ Shows a typical dilog box with single text box entry field """
+ dia = gtk.Dialog(title)
dia.show()
entry = gtk.Entry()
entry.show()
@@ -162,21 +207,8 @@
if response == gtk.RESPONSE_OK:
name = entry.get_text()
dia.destroy()
- self.insert_row(self.treemodelEXT,None, name)
+ return name
- def buttonRemoveMIMEExtension_clicked(self, widget):
- """ Remove selected extension name """
- self.delete_rows(self.treeviewEXT)
-
-
- def filechooserbutton2_file_set(self, widget):
- """ Place file path in entry field """
-
self.wTree.get_widget("enManager").set_text(self.wTree.get_widget("filechooserbutton2").get_filename())
-
- def filechooserbutton1_file_set(self, widget):
- """ Place file path in entry field """
-
self.wTree.get_widget("enStylesheet").set_text(self.wTree.get_widget("filechooserbutton1").get_filename())
-
if __name__ == "__main__":
ConfigUI = ConfigGUIGTK()
gtk.main()
Modified: trunk/misc/PyGTK_Control/XMLGui.glade
===================================================================
--- trunk/misc/PyGTK_Control/XMLGui.glade 2008-10-04 22:21:15 UTC (rev
2867)
+++ trunk/misc/PyGTK_Control/XMLGui.glade 2008-10-05 09:47:50 UTC (rev
2868)
@@ -784,6 +784,7 @@
<child>
<widget class="GtkComboBox" id="combobox3">
<property name="visible">True</property>
+ <property name="active">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
@@ -876,68 +877,102 @@
<property name="visible">True</property>
<child>
<widget class="GtkHBox" id="hbox4">
- <property name="height_request">20</property>
+ <property name="height_request">30</property>
<property name="visible">True</property>
<child>
- <widget class="GtkLabel" id="label23">
- <property name="width_request">100</property>
- <property name="height_request">20</property>
+ <widget class="GtkVBox" id="vbox13">
<property name="visible">True</property>
- <property name="label"
translatable="yes">Name:</property>
- <property name="single_line_mode">True</property>
+ <child>
+ <widget class="GtkLabel" id="label23">
+ <property name="width_request">100</property>
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="xpad">1</property>
+ <property name="ypad">5</property>
+ <property name="label"
translatable="yes">Name:</property>
+ <property
name="single_line_mode">True</property>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
<child>
- <widget class="GtkComboBox" id="combobox5">
- <property name="height_request">20</property>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkVBox" id="vbox11">
<property name="visible">True</property>
- <property name="has_frame">False</property>
- <property name="items" translatable="yes">Every
HTTP connection
-FTP connection</property>
+ <property name="spacing">3</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkComboBox" id="combobox5">
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="has_frame">False</property>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="padding">3</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="btnAddHostName">
- <property name="height_request">20</property>
+ <widget class="GtkVBox" id="vbox14">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="response_id">0</property>
- <signal name="clicked"
handler="on_btnAddHostName_clicked"/>
+ <child>
+ <widget class="GtkButton" id="btnAddHostName">
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked"
handler="on_btnAddHostName_clicked"/>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="btnRemoveHostName">
- <property name="height_request">20</property>
+ <widget class="GtkVBox" id="vbox10">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="response_id">0</property>
- <signal name="clicked"
handler="on_btnRemoveHostName_clicked"/>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkButton" id="btnRemoveHostName">
+ <property name="height_request">20</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ <signal name="clicked"
handler="on_btnRemoveHostName_clicked"/>
+ </widget>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="fill">False</property>
+ </packing>
</child>
<child>
<widget class="GtkNotebook" id="notebook2">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2868] Finishing MIME types selection.,
Ignacy Moryc <=