← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 254: Merged from the 2.0 development tree.

 

Merge authors:
  Eduardo César (eduardo.cesar)
------------------------------------------------------------
revno: 254 [merge]
committer: Eduardo C. P. Ribeiro <eduardo.cesar@xxxxxxx>
branch nick: mirror
timestamp: Thu 2012-09-13 23:56:46 -0300
message:
  Merged from the 2.0 development tree.
modified:
  src/2.0/cdd.py
  src/2.0/cdd.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 'src/2.0/cdd.py'
--- src/2.0/cdd.py	2012-09-10 21:01:04 +0000
+++ src/2.0/cdd.py	2012-09-14 02:56:05 +0000
@@ -26,6 +26,7 @@
 import ConfigParser
 import uuid
 import gettext
+import subprocess
 from xml.sax.saxutils import escape
 
 import wx
@@ -836,21 +837,15 @@
         tree = top_panel.tree_ctrl_ccd
         item = tree.GetSelection()
 
-        parent = self.GetParent()
-        grandparent = self.GetGrandParent()
-
         subject = None
         if self.radio_btn_cluster.GetValue():
-            sel_string = 'Cluster'
             subject = self.text_ctrl_cluster.GetValue()
+            sel_string = 'Cluster' ' .' + subject
         elif self.radio_btn_element.GetValue():
             sel_string = 'Element'
         elif self.radio_btn_slot.GetValue():
             sel_string = 'Slot'
 
-        if subject:
-            sel_string += ' .' + subject
-
         tree.AppendItem(item, sel_string)
         tree.Expand(item)
 
@@ -958,7 +953,13 @@
         # begin wxGlade: Definition.__init__
         kwds["style"] = wx.TAB_TRAVERSAL
         wx.Panel.__init__(self, *args, **kwds)
-        self.radio_box_definition = wx.RadioBox(self, -1, _("Select the type of the CCD:"), choices=[_("CareEntry"), _("AdminEntry"), _("DemographicEntry"), _("Cluster"), _("Element"), _("Slot")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
+        self.radio_btn_care_entry = wx.RadioButton(self, -1, _("CareEntry"))
+        self.radio_btn_admin_entry = wx.RadioButton(self, -1, _("AdminEntry"))
+        self.radio_btn_demographic_entry = wx.RadioButton(self, -1, _("DemographicEntry"))
+        self.radio_btn_cluster = wx.RadioButton(self, -1, _("Cluster"))
+        self.text_ctrl_cluster = wx.TextCtrl(self, -1, "")
+        self.radio_btn_element = wx.RadioButton(self, -1, _("Element"))
+        self.sizer_22_staticbox = wx.StaticBox(self, -1, _("Select the type of the CCD:"))
 
         self.__set_properties()
         self.__do_layout()
@@ -967,37 +968,62 @@
 
     def __set_properties(self):
         # begin wxGlade: Definition.__set_properties
-        self.radio_box_definition.SetSelection(0)
+        self.radio_btn_care_entry.SetForegroundColour(wx.Colour(127, 0, 255))
+        self.radio_btn_cluster.SetForegroundColour(wx.Colour(255, 127, 0))
+        self.text_ctrl_cluster.SetMinSize((100, 27))
+        self.radio_btn_element.SetForegroundColour(wx.Colour(255, 127, 0))
         # end wxGlade
 
     def __do_layout(self):
         # begin wxGlade: Definition.__do_layout
         sizer_5 = wx.BoxSizer(wx.VERTICAL)
-        sizer_5.Add(self.radio_box_definition, 1, wx.EXPAND, 0)
+        self.sizer_22_staticbox.Lower()
+        sizer_22 = wx.StaticBoxSizer(self.sizer_22_staticbox, wx.VERTICAL)
+        sizer_78 = wx.BoxSizer(wx.HORIZONTAL)
+        sizer_22.Add(self.radio_btn_care_entry, 0, 0, 0)
+        sizer_22.Add(self.radio_btn_admin_entry, 0, 0, 0)
+        sizer_22.Add(self.radio_btn_demographic_entry, 0, 0, 0)
+        sizer_78.Add(self.radio_btn_cluster, 0, 0, 0)
+        sizer_78.Add(self.text_ctrl_cluster, 0, 0, 0)
+        sizer_22.Add(sizer_78, 0, wx.EXPAND, 0)
+        sizer_22.Add(self.radio_btn_element, 0, 0, 0)
+        sizer_5.Add(sizer_22, 1, wx.EXPAND, 0)
         self.SetSizer(sizer_5)
         sizer_5.Fit(self)
         # end wxGlade
 
     def evt_button_ok(self):
-        grandparent = self.GetGrandParent()
-
-        sel_string = self.radio_box_definition.GetStringSelection()
-        tree = grandparent.tree_ctrl_ccd
-
-        tree_selected = tree.GetSelection()
+        top_panel = self.GetTopLevelParent()
+        tree = top_panel.tree_ctrl_ccd
+        item = tree.GetSelection()
+
+        sel_string = 'teste'
 
         # Tests if there is something at the tree
-        if tree.GetChildrenCount(tree_selected):
+        if tree.GetChildrenCount(item):
             dlg = wx.MessageDialog(self, 'Would you like to start over the CCD?', 'CCD', wx.YES_NO | wx.ICON_QUESTION)
 
             result = dlg.ShowModal()
             if result == wx.ID_YES:
-                tree.DeleteChildren(tree_selected)
+                tree.DeleteChildren(item)
             else:
                 return
 
-        tree.AppendItem(tree_selected, sel_string)
-        tree.Expand(tree_selected)
+        subject = None
+        if self.radio_btn_care_entry.GetValue():
+            sel_string = self.radio_btn_care_entry.GetLabel()
+        elif self.radio_btn_admin_entry.GetValue():
+            sel_string = self.radio_btn_admin_entry.GetLabel()
+        elif self.radio_btn_demographic_entry.GetValue():
+            sel_string = self.radio_btn_demographic_entry.GetLabel()
+        elif self.radio_btn_cluster.GetValue():
+            subject = self.text_ctrl_cluster.GetValue()
+            sel_string = self.radio_btn_cluster.GetLabel() + ' .' + subject
+        elif self.radio_btn_element.GetValue():
+            sel_string = self.radio_btn_element.GetLabel()
+
+        tree.AppendItem(item, sel_string)
+        tree.Expand(item)
 
 # end of class Definition
 
@@ -1305,12 +1331,6 @@
         # begin wxGlade: MyPanel4.__init__
         kwds["style"] = wx.TAB_TRAVERSAL
         wx.Panel.__init__(self, *args, **kwds)
-        self.radio_btn_care_entry = wx.RadioButton(self, -1, _("CareEntry"))
-        self.radio_btn_admin_entry = wx.RadioButton(self, -1, _("AdminEntry"))
-        self.radio_btn_demographic_entry = wx.RadioButton(self, -1, _("DemographicEntry"))
-        self.radio_btn_cluster = wx.RadioButton(self, -1, _("Cluster"))
-        self.radio_btn_element = wx.RadioButton(self, -1, _("Element"))
-        self.sizer_22_staticbox = wx.StaticBox(self, -1, _("Select the type of the CCD:"))
         self.radio_box_language_copy = wx.RadioBox(self, -1, _("Selected?"), choices=[_("No"), _("Yes")], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
         self.choice_language_copy = wx.Choice(self, -1, choices=[])
         self.sizer_48_copy_copy_staticbox = wx.StaticBox(self, -1, _("language"))
@@ -1323,9 +1343,6 @@
 
     def __set_properties(self):
         # begin wxGlade: MyPanel4.__set_properties
-        self.radio_btn_care_entry.SetForegroundColour(wx.Colour(127, 0, 255))
-        self.radio_btn_cluster.SetForegroundColour(wx.Colour(255, 127, 0))
-        self.radio_btn_element.SetForegroundColour(wx.Colour(255, 127, 0))
         self.radio_box_language_copy.SetSelection(0)
         self.choice_language_copy.Enable(False)
         # end wxGlade
@@ -1335,14 +1352,6 @@
         sizer_16 = wx.BoxSizer(wx.HORIZONTAL)
         self.sizer_48_copy_copy_staticbox.Lower()
         sizer_48_copy_copy = wx.StaticBoxSizer(self.sizer_48_copy_copy_staticbox, wx.HORIZONTAL)
-        self.sizer_22_staticbox.Lower()
-        sizer_22 = wx.StaticBoxSizer(self.sizer_22_staticbox, wx.VERTICAL)
-        sizer_22.Add(self.radio_btn_care_entry, 0, 0, 0)
-        sizer_22.Add(self.radio_btn_admin_entry, 0, 0, 0)
-        sizer_22.Add(self.radio_btn_demographic_entry, 0, 0, 0)
-        sizer_22.Add(self.radio_btn_cluster, 0, 0, 0)
-        sizer_22.Add(self.radio_btn_element, 0, 0, 0)
-        sizer_16.Add(sizer_22, 1, wx.EXPAND, 0)
         sizer_48_copy_copy.Add(self.radio_box_language_copy, 0, 0, 0)
         sizer_48_copy_copy.Add((20, 20), 1, wx.EXPAND, 0)
         sizer_48_copy_copy.Add(self.choice_language_copy, 0, 0, 0)
@@ -1727,7 +1736,7 @@
         self.Bind(wx.EVT_BUTTON, self.evt_button_remove, self.button_remove)
         self.Bind(wx.EVT_BUTTON, self.evt_button_ok, self.button_ok)
         # end wxGlade
-        #self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.evt_tree_item_right_click, self.tree_ctrl_ccd)
+        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.evt_tree_item_right_click, self.tree_ctrl_ccd)
 
         self.init_things()
 
@@ -1818,9 +1827,9 @@
     def evt_tree_item_activated(self, event):  # wxGlade: MainFrame.<event_handler>
         pass
 
-    # def evt_tree_item_right_click(self, event):  # wxGlade: MainFrame.<event_handler>
-    #     item =  event.GetItem()
-    #     self.tree_ctrl_ccd.Delete(item)
+    def evt_tree_item_right_click(self, event):  # wxGlade: MainFrame.<event_handler>
+        item =  event.GetItem()
+
 
     def evt_tree_sel_changed(self, event):  # wxGlade: MainFrame.<event_handler>
 
@@ -2018,8 +2027,12 @@
         event.Skip()
 
     def help_users_guide(self, event):  # wxGlade: MainFrame.<event_handler>
-        print "Event handler `help_users_guide' not implemented"
-        event.Skip()
+        doc = '../../docs/cdd-manual.pdf'
+
+        if sys.platform == 'linux2':
+            subprocess.call(["xdg-open", doc])
+        else:
+            os.startfile(doc)
 
     def help_about(self, event):  # wxGlade: MainFrame.<event_handler>
         # First we create and fill the info object

=== modified file 'src/2.0/cdd.wxg'
--- src/2.0/cdd.wxg	2012-09-10 21:01:04 +0000
+++ src/2.0/cdd.wxg	2012-09-11 22:49:55 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- generated by wxGlade 0.6.4 on Mon Sep 10 17:59:14 2012 -->
+<!-- generated by wxGlade 0.6.4 on Tue Sep 11 19:48:56 2012 -->
 
 <application path="cdd.py" name="" class="" option="0" language="python" top_window="dialog_config" encoding="UTF-8" use_gettext="1" 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_main" base="EditFrame">
@@ -546,53 +546,7 @@
         <style>wxTAB_TRAVERSAL</style>
         <object class="wxBoxSizer" name="sizer_16" base="EditBoxSizer">
             <orient>wxHORIZONTAL</orient>
-            <object class="sizeritem">
-                <flag>wxEXPAND</flag>
-                <border>0</border>
-                <option>1</option>
-                <object class="wxStaticBoxSizer" name="sizer_22" base="EditStaticBoxSizer">
-                    <orient>wxVERTICAL</orient>
-                    <label>Select the type of the CCD:</label>
-                    <object class="sizeritem">
-                        <border>0</border>
-                        <option>0</option>
-                        <object class="wxRadioButton" name="radio_btn_care_entry" base="EditRadioButton">
-                            <foreground>#7f00ff</foreground>
-                            <label>CareEntry</label>
-                        </object>
-                    </object>
-                    <object class="sizeritem">
-                        <border>0</border>
-                        <option>0</option>
-                        <object class="wxRadioButton" name="radio_btn_admin_entry" base="EditRadioButton">
-                            <label>AdminEntry</label>
-                        </object>
-                    </object>
-                    <object class="sizeritem">
-                        <border>0</border>
-                        <option>0</option>
-                        <object class="wxRadioButton" name="radio_btn_demographic_entry" base="EditRadioButton">
-                            <label>DemographicEntry</label>
-                        </object>
-                    </object>
-                    <object class="sizeritem">
-                        <border>0</border>
-                        <option>0</option>
-                        <object class="wxRadioButton" name="radio_btn_cluster" base="EditRadioButton">
-                            <foreground>#ff7f00</foreground>
-                            <label>Cluster</label>
-                        </object>
-                    </object>
-                    <object class="sizeritem">
-                        <border>0</border>
-                        <option>0</option>
-                        <object class="wxRadioButton" name="radio_btn_element" base="EditRadioButton">
-                            <foreground>#ff7f00</foreground>
-                            <label>Element</label>
-                        </object>
-                    </object>
-                </object>
-            </object>
+            <object class="sizerslot" />
             <object class="sizerslot" />
             <object class="sizeritem">
                 <border>0</border>
@@ -648,19 +602,62 @@
                 <flag>wxEXPAND</flag>
                 <border>0</border>
                 <option>1</option>
-                <object class="wxRadioBox" name="radio_box_definition" base="EditRadioBox">
-                    <style>wxRA_SPECIFY_ROWS</style>
-                    <selection>0</selection>
-                    <dimension>0</dimension>
+                <object class="wxStaticBoxSizer" name="sizer_22" base="EditStaticBoxSizer">
+                    <orient>wxVERTICAL</orient>
                     <label>Select the type of the CCD:</label>
-                    <choices>
-                        <choice>CareEntry</choice>
-                        <choice>AdminEntry</choice>
-                        <choice>DemographicEntry</choice>
-                        <choice>Cluster</choice>
-                        <choice>Element</choice>
-                        <choice>Slot</choice>
-                    </choices>
+                    <object class="sizeritem">
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxRadioButton" name="radio_btn_care_entry" base="EditRadioButton">
+                            <foreground>#7f00ff</foreground>
+                            <label>CareEntry</label>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxRadioButton" name="radio_btn_admin_entry" base="EditRadioButton">
+                            <label>AdminEntry</label>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxRadioButton" name="radio_btn_demographic_entry" base="EditRadioButton">
+                            <label>DemographicEntry</label>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxBoxSizer" name="sizer_78" base="EditBoxSizer">
+                            <orient>wxHORIZONTAL</orient>
+                            <object class="sizeritem">
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxRadioButton" name="radio_btn_cluster" base="EditRadioButton">
+                                    <foreground>#ff7f00</foreground>
+                                    <label>Cluster</label>
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxTextCtrl" name="text_ctrl_cluster" base="EditTextCtrl">
+                                    <size>100, 27</size>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxRadioButton" name="radio_btn_element" base="EditRadioButton">
+                            <foreground>#ff7f00</foreground>
+                            <label>Element</label>
+                        </object>
+                    </object>
                 </object>
             </object>
         </object>