mlhim-specs-dev team mailing list archive
-
mlhim-specs-dev team
-
Mailing list archive
-
Message #00570
[Branch ~cdd-dev/cdd/trunk] Rev 156: Added mandatary options.
------------------------------------------------------------
revno: 156
fixes bug: https://launchpad.net/bugs/1021993
committer: Eduardo César <xcesar@xxxxxxxxx>
branch nick: cdd
timestamp: Fri 2012-07-06 23:11:53 -0300
message:
Added mandatary options.
modified:
Generator/cdg/MainFrame.py
Generator/cdg/cdg_extra.py
Generator/cdg_wxglade.wxg
--
lp:cdd
https://code.launchpad.net/~cdd-dev/cdd/trunk
Your team MLHIM Specifications Developers is subscribed to branch lp:cdd.
To unsubscribe from this branch go to https://code.launchpad.net/~cdd-dev/cdd/trunk/+edit-subscription
=== modified file 'Generator/cdg/MainFrame.py'
--- Generator/cdg/MainFrame.py 2012-07-07 01:51:13 +0000
+++ Generator/cdg/MainFrame.py 2012-07-07 02:11:53 +0000
@@ -19,23 +19,23 @@
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.panel_principal = wx.Panel(self, -1)
- self.label_title = wx.StaticText(self.panel_principal, -1, "Title: ", style=wx.ALIGN_CENTRE)
+ self.label_title = wx.StaticText(self.panel_principal, -1, "* Title: ", style=wx.ALIGN_CENTRE)
self.text_ctrl_title = wx.TextCtrl(self.panel_principal, -1, "")
self.label_date = wx.StaticText(self.panel_principal, -1, "Date :")
self.datepicker_ctrl_date = wx.DatePickerCtrl(self.panel_principal, -1)
- self.label_description = wx.StaticText(self.panel_principal, -1, "Description: ")
+ self.label_description = wx.StaticText(self.panel_principal, -1, "* Description: ")
self.text_ctrl_description = wx.TextCtrl(self.panel_principal, -1, "", style=wx.TE_MULTILINE)
self.label_language = wx.StaticText(self.panel_principal, -1, "Language: ")
self.choice_lang = wx.Choice(self.panel_principal, -1, choices=[])
- self.label_creator = wx.StaticText(self.panel_principal, -1, "Creator: ")
+ self.label_creator = wx.StaticText(self.panel_principal, -1, "* Creator: ")
self.text_ctrl_creator = wx.TextCtrl(self.panel_principal, -1, "")
self.label_publisher = wx.StaticText(self.panel_principal, -1, "Publisher: ")
self.text_ctrl_publisher = wx.TextCtrl(self.panel_principal, -1, "")
- self.label_subject = wx.StaticText(self.panel_principal, -1, "Subject: ")
+ self.label_subject = wx.StaticText(self.panel_principal, -1, "* Subject: ")
self.text_ctrl_subject = wx.TextCtrl(self.panel_principal, -1, "")
self.label_source = wx.StaticText(self.panel_principal, -1, "Source: ")
self.text_ctrl_source = wx.TextCtrl(self.panel_principal, -1, "")
- self.label_rights = wx.StaticText(self.panel_principal, -1, "Rights: ")
+ self.label_rights = wx.StaticText(self.panel_principal, -1, "* Rights: ")
self.text_ctrl_rights = wx.TextCtrl(self.panel_principal, -1, "")
self.label_relation = wx.StaticText(self.panel_principal, -1, "Relation: ")
self.text_ctrl_relation = wx.TextCtrl(self.panel_principal, -1, "")
@@ -170,10 +170,6 @@
def generate(self, event): # wxGlade: MainFrame.<event_handler>
- # Get the path
- path = cdg_extra.get_path(self)
- if not path:
- return
title = self.text_ctrl_title.GetValue().encode('utf8')
description = self.text_ctrl_description.GetValue().encode('utf8')
@@ -193,6 +189,18 @@
tempo = self.datepicker_ctrl_date.GetValue()
date = '{Y}-{M}-{D:02}'.format(Y=tempo.GetYear(), M=tempo.GetMonth(), D=tempo.GetDay())
+
+ # Test if the mandatary fields are with something
+ if not (title and date and description and creator and subject and rights):
+ cdg_extra.popup_message(self, 'The options marker with a "*" are mandatory. Please fill them before generating a CCD file.', wx.ICON_EXCLAMATION)
+ return
+
+ # Get the path
+ path = cdg_extra.get_path(self)
+ if not path:
+ return
+
+
# Call the writing routine
ccd_id = cdg_custom.generate_files(path, title, description, date, creator, contributor, language, publisher, subject, source, rights, relation, coverage, choice_definition)
@@ -200,14 +208,6 @@
# Show dialog
cdg_extra.wrote_diag(self, ccd_id)
- def init_things(self):
-
- cdg_extra.set_icon(self)
- self.c = cdg_custom.Config(self)
- self.c.read_config()
- self.c.set_panel_configs()
- self.button_save_config.Disable()
-
def about(self, event): # wxGlade: MainFrame.<event_handler>
cdg_extra.about_box(self)
@@ -229,4 +229,13 @@
self.c.save_config()
self.button_save_config.Disable()
+
+ def init_things(self):
+ cdg_extra.set_icon(self)
+ self.c = cdg_custom.Config(self)
+ self.c.read_config()
+ self.c.set_panel_configs()
+ self.button_save_config.Disable()
+
+
# end of class MainFrame
=== modified file 'Generator/cdg/cdg_extra.py'
--- Generator/cdg/cdg_extra.py 2012-07-07 01:51:13 +0000
+++ Generator/cdg/cdg_extra.py 2012-07-07 02:11:53 +0000
@@ -91,14 +91,13 @@
icon = wx.IconFromBitmap(bitmap)
self.SetIcon(icon)
-def quit_program(self):
- dlg = wx.MessageDialog(self,
- "Are you sure you want to exit?",
- "Quit", wx.OK|wx.CANCEL|wx.ICON_QUESTION)
+def popup_message(self, msg, icon):
+ dlg = wx.MessageDialog(self, msg,
+ "", wx.OK|icon)
result = dlg.ShowModal()
dlg.Destroy()
- if result == wx.ID_OK:
- self.Destroy()
+ # if result == wx.ID_OK:
+ # self.Destroy()
def quit_program(self):
msg = "Are you sure you want to exit?"
=== modified file 'Generator/cdg_wxglade.wxg'
--- Generator/cdg_wxglade.wxg 2012-07-07 01:51:13 +0000
+++ Generator/cdg_wxglade.wxg 2012-07-07 02:11:53 +0000
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!-- generated by wxGlade 0.6.4 on Fri Jul 6 22:46:26 2012 -->
+<!-- generated by wxGlade 0.6.4 on Fri Jul 6 22:58:30 2012 -->
<application path="cdg" name="" class="" option="1" language="python" top_window="frame_principal" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0" indent_amount="4" indent_symbol="space" source_extension=".cpp" header_extension=".h">
<object class="MainFrame" name="frame_principal" base="EditFrame">
@@ -52,7 +52,7 @@
<object class="wxStaticText" name="label_title" base="EditStaticText">
<style>wxALIGN_CENTRE</style>
<attribute>1</attribute>
- <label>Title: </label>
+ <label>* Title: </label>
</object>
</object>
<object class="sizeritem">
@@ -105,7 +105,7 @@
<option>0</option>
<object class="wxStaticText" name="label_description" base="EditStaticText">
<attribute>1</attribute>
- <label>Description: </label>
+ <label>* Description: </label>
</object>
</object>
<object class="sizeritem">
@@ -168,7 +168,7 @@
<object class="wxStaticText" name="label_creator" base="EditStaticText">
<attribute>1</attribute>
<tooltip>Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx></tooltip>
- <label>Creator: </label>
+ <label>* Creator: </label>
</object>
</object>
<object class="sizeritem">
@@ -224,7 +224,7 @@
<option>0</option>
<object class="wxStaticText" name="label_subject" base="EditStaticText">
<attribute>1</attribute>
- <label>Subject: </label>
+ <label>* Subject: </label>
</object>
</object>
<object class="sizeritem">
@@ -279,7 +279,7 @@
<option>0</option>
<object class="wxStaticText" name="label_rights" base="EditStaticText">
<attribute>1</attribute>
- <label>Rights: </label>
+ <label>* Rights: </label>
</object>
</object>
<object class="sizeritem">