← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 180: Removed redundant & unused code.

 

------------------------------------------------------------
revno: 180
committer: Eduardo César <xcesar@xxxxxxxxx>
branch nick: cdd
timestamp: Tue 2012-07-17 22:11:04 -0300
message:
  Removed redundant & unused code.
removed:
  src/cdd_utils.py
modified:
  src/cdd.py
  src/cdg_extra.py
  src/mlhim2.py


--
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/cdd.py'
--- src/cdd.py	2012-07-18 00:27:38 +0000
+++ src/cdd.py	2012-07-18 01:11:04 +0000
@@ -8,7 +8,6 @@
 from wx.lib.wordwrap import wordwrap
 
 import mlhim2
-import cdd_utils
 
 gettext.bindtextdomain('CDD','locales/en')
 gettext.textdomain('CDD')

=== removed file 'src/cdd_utils.py'
--- src/cdd_utils.py	2012-07-12 22:28:29 +0000
+++ src/cdd_utils.py	1970-01-01 00:00:00 +0000
@@ -1,58 +0,0 @@
-# -*- coding: utf-8 -*-
-# cdd_utils.py - CCD editor for MLHIM.
-# (c) 2012 - Timothy w.Cook & Contributors. (see: CDD.py - credits)
-
-import os
-import locale
-import pkgutil
-import StringIO
-
-import wx
-from wx.lib.wordwrap import wordwrap
-
-def wrote_diag(self, ccd_id):
-    schema = ccd_id + ".xsd"
-    dlg = wx.MessageDialog(self, "%s" % schema,
-
-                           'Generated the file',
-                           wx.OK | wx.ICON_INFORMATION
-                           #wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_INFORMATION
-                           )
-    dlg.ShowModal()
-    dlg.Destroy()
-
-
-
-def get_path(self):
-    path = os.getcwd()
-
-    dlg = wx.DirDialog(self, "Choose a directory to put the generated files:",
-                       path,
-                       style=wx.DD_DEFAULT_STYLE
-                       #| wx.DD_DIR_MUST_EXIST
-                       #| wx.DD_CHANGE_DIR
-                       )
-
-
-    if dlg.ShowModal() == wx.ID_OK:
-        path = dlg.GetPath()
-    else:
-        return None
-
-    dlg.Destroy()
-    return path
-
-def get_lang_list():
-    l = list(set(locale.locale_alias.keys()))
-    l.sort()
-    l2 = [i.replace('_','-')[0:3] + i[3:].upper() for i in l if ((len(i) < 6 and '_' in i) or len(i) == 2)]
-
-    return l2
-
-def set_icon(self):
-    logo_str = pkgutil.get_data(__name__, 'logo.png')
-    stio = StringIO.StringIO(logo_str)
-    image = wx.ImageFromStream(stio)
-    bitmap = wx.BitmapFromImage(image)
-    icon = wx.IconFromBitmap(bitmap)
-    self.SetIcon(icon)

=== modified file 'src/cdg_extra.py'
--- src/cdg_extra.py	2012-07-18 00:27:38 +0000
+++ src/cdg_extra.py	2012-07-18 01:11:04 +0000
@@ -1,15 +1,11 @@
 # -*- coding: utf-8 -*-
 import os
 import locale
-import pkgutil
-import StringIO
 import sys
 
 import wx
 from wx.lib.wordwrap import wordwrap
 
-
-
 def help_box(self):
 
     dlg = wx.MessageDialog(self, """
@@ -25,44 +21,6 @@
                            )
     dlg.ShowModal()
     dlg.Destroy()
-
-def about_box(self):
-    info = wx.AboutDialogInfo()
-    info.Name = "CDG Version 1.0\n[RM version (2.3.0)]"
-    #info.Version = "1.2.3"
-
-    info.Description = wordwrap(
-        "See http://dublincore.org/documents/dcmi-terms/ for explanation of how to enter the metadata for the CCD.",
-        400, wx.ClientDC(self))
-    info.WebSite = ("http://www.hkcr.net/tools";, "HKCR Website")
-
-    info.Developers = [ "Eduardo César <xcesar@xxxxxxxxx>",
-                        "Timothy W. Cook <timothywayne.cook@xxxxxxxxx>",
-                        ]
-
-    info.License = wordwrap(LICENSE, 500, wx.ClientDC(self))
-    # Then we call wx.AboutBox giving it that info object
-    return wx.AboutBox(info)
-
-def get_path(self):
-    path = os.getcwd()
-
-    dlg = wx.DirDialog(self, "Choose a directory to put the generated files:",
-                       path,
-                       style=wx.DD_DEFAULT_STYLE
-                       #| wx.DD_DIR_MUST_EXIST
-                       #| wx.DD_CHANGE_DIR
-                       )
-
-
-    if dlg.ShowModal() == wx.ID_OK:
-        path = dlg.GetPath()
-    else:
-        return None
-
-    dlg.Destroy()
-    return path
-
 def get_lang_list():
     l = list(set(locale.locale_alias.keys()))
     l.sort()
@@ -70,17 +28,6 @@
 
     return l2
 
-def set_icon(self):
-    if sys.platform.startswith('linux'):
-        logo_str = pkgutil.get_data(__name__, 'logo.png')
-        stio = StringIO.StringIO(logo_str)
-        image = wx.ImageFromStream(stio)
-        bitmap = wx.BitmapFromImage(image)
-        icon = wx.IconFromBitmap(bitmap)
-        self.SetIcon(icon)
-
-        
-
 def popup_message(self, msg, tag, icons):
     dlg = wx.MessageDialog(self, msg, tag, icons)
     result = dlg.ShowModal()
@@ -89,35 +36,3 @@
         return True
     else:
         return False
-
-def quit_program(self):
-    msg = "Are you sure you want to exit?"
-    icon = wx.ICON_QUESTION
-    if self.button_save_config.Enabled:
-        msg = "Configuration not saved!\nAre you sure you want to exit?"
-        icon = wx.ICON_EXCLAMATION
-
-    dlg = wx.MessageDialog(self, msg,
-                           "Quit", wx.OK|wx.CANCEL|icon)
-    result = dlg.ShowModal()
-    dlg.Destroy()
-    if result == wx.ID_OK:
-        self.Destroy()
-
-
-
-LICENSE = """
-This program is free software: you can redistribute it and/or modify
-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/>.
-"""
-

=== modified file 'src/mlhim2.py'
--- src/mlhim2.py	2012-07-18 00:27:38 +0000
+++ src/mlhim2.py	2012-07-18 01:11:04 +0000
@@ -10,7 +10,6 @@
 import cdg_custom
 from wx.lib.wordwrap import wordwrap
 
-import cdd_utils
 import cdg_main
 
 gettext.bindtextdomain('CDD','locales/en')
@@ -18,232 +17,6 @@
 _ = gettext.gettext
 
 # form for entering metadata.
-# class Metadata(wx.Panel):
-# #TODO:  Eduardo to add his CDG form here.
-#     def __init__(self, mf):
-#         wx.Panel.__init__(self, mf.panel2, -1, size=(300,300), style=wx.DOUBLE_BORDER)
-
-#         self.st1 = wx.StaticText(self, -1, "This is my Metadata form. There is nothing here yet.", (20,10))
-
-# class Metadata(wx.Dialog):
-#     def __init__(self, *args, **kwds):
-#     #def __init__(self, mf):
-#         # begin wxGlade: MainFrame.__init__
-#         kwds["style"] = wx.DEFAULT_FRAME_STYLE
-
-#         wx.Dialog.__init__(self, *args, **kwds)
-#         #wx.Dialog.__init__(self, mf.panel2, -1, size=(600,400), style=wx.DOUBLE_BORDER)
-
-#         self.panel_principal = wx.Panel(self, -1)
-#         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.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 name:  ")
-#         self.text_ctrl_creator = wx.TextCtrl(self.panel_principal, -1, "")
-#         self.label_creator_email = wx.StaticText(self.panel_principal, -1, "Creator email:  ")
-#         self.text_ctrl_creator_email = wx.TextCtrl(self.panel_principal, -1, "")
-#         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.text_ctrl_rights = 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_relation = wx.StaticText(self.panel_principal, -1, "Relation:  ")
-#         self.text_ctrl_relation = wx.TextCtrl(self.panel_principal, -1, "")
-#         self.label_coverage = wx.StaticText(self.panel_principal, -1, "Coverage:  ")
-#         self.text_ctrl_coverage = wx.TextCtrl(self.panel_principal, -1, "")
-#         self.label_contributors = wx.StaticText(self.panel_principal, -1, "Contributors:  ")
-#         self.text_ctrl_contributors = wx.TextCtrl(self.panel_principal, -1, "")
-#         # self.button_about = wx.Button(self.panel_principal, -1, "&About")
-#         # self.button_save_config = wx.Button(self.panel_principal, -1, "Save config")
-#         # self.button_help = wx.Button(self.panel_principal, wx.ID_HELP, "")
-#         # self.button_generate = wx.Button(self.panel_principal, -1, "&Generate")
-#         # self.button_1 = wx.Button(self.panel_principal, wx.ID_EXIT, "")
-
-#         self.__set_properties()
-#         self.__do_layout()
-
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_title)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_description)
-#         # self.Bind(wx.EVT_CHOICE, self.enable_save, self.choice_lang)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_creator)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_creator_email)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_subject)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_source)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_rights)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_publisher)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_relation)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_coverage)
-#         # self.Bind(wx.EVT_TEXT, self.enable_save, self.text_ctrl_contributors)
-#         # self.Bind(wx.EVT_BUTTON, self.about, self.button_about)
-#         # self.Bind(wx.EVT_BUTTON, self.save_config, self.button_save_config)
-#         # self.Bind(wx.EVT_BUTTON, self.help, self.button_help)
-#         # self.Bind(wx.EVT_BUTTON, self.generate, self.button_generate)
-#         # self.Bind(wx.EVT_BUTTON, self.quit_program, self.button_1)
-#         # end wxGlade
-
-#         self.init_things()
-
-
-#     def __set_properties(self):
-#         # begin wxGlade: MainFrame.__set_properties
-# #        self.SetTitle("Constraint Definition Generator")
-#         #self.SetSize((800, 470))
-#         self.label_date.SetToolTipString("Defalts to current day.")
-#         self.datepicker_ctrl_date.SetMinSize((111, 28))
-#         self.choice_lang.SetItems(cdg_extra.get_lang_list())
-#         self.choice_lang.SetSelection(cdg_extra.get_lang_list().index('en-US') | 0)
-#         self.label_creator.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
-#         self.text_ctrl_creator.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
-#         self.text_ctrl_subject.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
-#         self.text_ctrl_publisher.SetToolTipString("Format emails as: Timothy W. Cook <timothywayne.cook@xxxxxxxxx>")
-#         self.label_contributors.SetToolTipString("Separate multiple contributors with a semi-colon and format them as:Eduardo Cesar <xcesar@xxxxxxxxx>; Luciana Cavalini <lutricav@xxxxxxxxx>")
-#         self.text_ctrl_contributors.SetToolTipString("Separate multiple contributors with a semi-colon and format them as:Eduardo Cesar <xcesar@xxxxxxxxx>; Luciana Cavalini <lutricav@xxxxxxxxx>")
-#         #self.button_save_config.Enable(False)
-#         # end wxGlade
-
-#     def __do_layout(self):
-#         # begin wxGlade: MainFrame.__do_layout
-#         sizer_principal = wx.BoxSizer(wx.VERTICAL)
-#         sizer_vertical = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_3 = wx.BoxSizer(wx.VERTICAL)
-#         sizer_2_copy = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_6 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_4 = wx.BoxSizer(wx.HORIZONTAL)
-#         sizer_vertical.Add((20, 20), 0, 0, 0)
-#         sizer_3.Add((20, 20), 0, 0, 0)
-#         sizer_4.Add(self.label_title, 0, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_4.Add(self.text_ctrl_title, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_4.Add((20, 20), 0, 0, 0)
-#         sizer_4.Add(self.label_date, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_4.Add(self.datepicker_ctrl_date, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_3.Add(sizer_4, 1, wx.ALL | wx.EXPAND, 1)
-#         sizer_5.Add(self.label_description, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_5.Add(self.text_ctrl_description, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_5.Add((20, 20), 0, 0, 0)
-#         sizer_5.Add(self.label_language, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_5.Add(self.choice_lang, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_3.Add(sizer_5, 1, wx.EXPAND, 0)
-#         sizer_6.Add(self.label_creator, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_6.Add(self.text_ctrl_creator, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_6.Add((20, 20), 0, 0, 0)
-#         sizer_6.Add(self.label_creator_email, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_6.Add(self.text_ctrl_creator_email, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_6.Add((20, 20), 0, 0, 0)
-#         sizer_6.Add(self.label_subject, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_6.Add(self.text_ctrl_subject, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_3.Add(sizer_6, 1, wx.EXPAND, 0)
-#         sizer_7.Add(self.label_source, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_7.Add(self.text_ctrl_source, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_7.Add((20, 20), 0, 0, 0)
-#         sizer_7.Add(self.label_rights, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_7.Add(self.text_ctrl_rights, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_7.Add((20, 20), 0, 0, 0)
-#         sizer_7.Add(self.label_publisher, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_7.Add(self.text_ctrl_publisher, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_3.Add(sizer_7, 1, wx.EXPAND, 0)
-#         sizer_8.Add(self.label_relation, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_8.Add(self.text_ctrl_relation, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_8.Add((20, 20), 0, 0, 0)
-#         sizer_8.Add(self.label_coverage, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_8.Add(self.text_ctrl_coverage, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_3.Add(sizer_8, 1, wx.EXPAND, 0)
-#         sizer_1.Add(self.label_contributors, 0, wx.ALIGN_CENTER_VERTICAL, 0)
-#         sizer_1.Add(self.text_ctrl_contributors, 1, wx.ALIGN_CENTER_VERTICAL, 1)
-#         sizer_3.Add(sizer_1, 1, wx.EXPAND, 0)
-#         # sizer_2_copy.Add(self.button_about, 0, wx.ALIGN_BOTTOM, 0)
-#         # sizer_2_copy.Add((20, 20), 0, 0, 0)
-#         # sizer_2_copy.Add(self.button_save_config, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, 0)
-#         # sizer_2_copy.Add((20, 20), 1, wx.EXPAND, 1)
-#         # sizer_2_copy.Add((20, 20), 0, 0, 0)
-#         # sizer_2_copy.Add(self.button_help, 0, wx.ALIGN_BOTTOM, 0)
-#         # sizer_2_copy.Add((20, 20), 0, 0, 0)
-#         # sizer_2_copy.Add(self.button_generate, 0, wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_VERTICAL, 1)
-#         # sizer_2_copy.Add((20, 20), 0, 0, 0)
-#         # sizer_2_copy.Add(self.button_1, 0, wx.ALIGN_BOTTOM, 0)
-#         # sizer_3.Add(sizer_2_copy, 1, wx.EXPAND, 0)
-#         sizer_3.Add((20, 20), 0, 0, 0)
-#         sizer_vertical.Add(sizer_3, 1, wx.EXPAND, 0)
-#         sizer_vertical.Add((20, 20), 0, 0, 0)
-#         self.panel_principal.SetSizer(sizer_vertical)
-#         sizer_principal.Add(self.panel_principal, 1, wx.EXPAND, 0)
-#         self.SetSizer(sizer_principal)
-#         self.Layout()
-#         self.Centre()
-#         # end wxGlade
-
-#     def generate(self, event):  # wxGlade: MainFrame.<event_handler>
-
-#         title = self.text_ctrl_title.GetValue().encode('utf8')
-#         description = self.text_ctrl_description.GetValue().encode('utf8')
-#         creator = self.text_ctrl_creator.GetValue().encode('utf8')
-#         creator_email = self.text_ctrl_creator_email.GetValue().encode('utf8')
-#         contributor = self.text_ctrl_contributors.GetValue().encode('utf8')
-
-#         publisher = self.text_ctrl_publisher.GetValue().encode('utf8')
-#         subject = self.text_ctrl_subject.GetValue().encode('utf8')
-#         source = self.text_ctrl_source.GetValue().encode('utf8')
-#         rights = self.text_ctrl_rights.GetValue().encode('utf8')
-#         relation = self.text_ctrl_relation.GetValue().encode('utf8')
-#         coverage = self.text_ctrl_coverage.GetValue().encode('utf8')
-
-#         language = self.choice_lang.GetStringSelection()
-
-#         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.', 'Error', wx.OK|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, creator_email, contributor, language, publisher, subject, source, rights, relation, coverage)
-
-
-#         # Show dialog
-#         cdg_extra.popup_message(self, '%s.xsd' % ccd_id, 'Generated the file', wx.OK | wx.ICON_INFORMATION)
-
-#     # def about(self, event):  # wxGlade: MainFrame.<event_handler>
-#     #     cdg_extra.about_box(self)
-
-#     # def help(self, event):  # wxGlade: MainFrame.<event_handler>
-#     #     cdg_extra.help_box(self)
-
-#     # def quit_program(self, event):  # wxGlade: MainFrame.<event_handler>
-#     #     cdg_extra.quit_program(self)
-
-#     # def enable_save(self, event):  # wxGlade: MainFrame.<event_handler>
-#     #     self.button_save_config.Enable()
-
-#     def init_things(self):
-#         pass
-#         # self.c = cdg_custom.Config(self)
-#         # self.c.read_config()
-#         # self.c.set_panel_configs()
-
-# # end of class Metadata
-
 class Metadata(cdg_main.MainDialog):
     pass