mda2idd_gui

Source code documentation

mda2idd_gui Module

GUI for mda2idd_report

Objectives

Provide GUI tools to browse a file system and select MDA files. Process them with mda2idd_report.

Instructions

Browse to a directory containing MDA files. Select one. A summary will be shown. Choose: * File –> Save (or ^S) to convert selected MDA file to an ASCII text file. * File –> Convert entire Directory (^D) to convert all MDA files

For now, only *.mda files may be browsed. ASCII text files will be written to directory: ../ASCII/ (relative to the MDA file directory)

Features

  • presents file system list
  • adds directory picker dialog and text entry box
  • preview brief header or full summary of MDA file (^B)
  • convert one selected MDA file to ASCII (^S)
  • convert entire directory of MDA files to ASCII (^D)

Source Code Documentation

MainWindow([parent, start_fresh]) Manage the application through the main window

class mda2idd_gui.MainWindow(parent=None, start_fresh=False)[source]

Bases: wx._windows.Frame

Manage the application through the main window

GetDefaultPreferencesFileName()[source]

return the name of the preferences file for this session

The preferences file, an XML file that contains recent program settings for specific program features, is saved in the HOME (or USERPROFILE on Windows) directory for the user account under the .mda2idd_gui_rc.xml file name. Here is an example from a Windows 7 system:

<?xml version="1.0" encoding="UTF-8"?>
<mda2idd_gui datetime="2013-03-06 13:09:17.593000" version="2013-02">
  <preferences_file>C:\Users\Pete\.mda2idd_gui_rc.xml</preferences_file>
  <written_by program="C:\Users\Pete\Documents\eclipse\mda2idd_report\src\mda2idd_gui.py"/>
  <subversion id="$Id$"/>
  <window>
    <size h="1212" v="561"/>
    <position h="114" v="232"/>
    <sash pos="300"/>
  </window>
  <file_filter>*.mda</file_filter>
  <starting_directory>C:\Users\Pete\Documents\eclipse\mda2idd_report\data\mda</starting_directory>
  <short_summary>False</short_summary>
  <mrud max_directories="9">
    <!--MRUD: Most-Recently-Used Directory-->
    <dir>C:\Users\Pete\Documents\eclipse\mda2idd_report\data\mda</dir>
    <dir>C:\Users\Pete\Apps\epics\synAppsSVN\support\sscan\documentation</dir>
    <dir>C:\Temp\mdalib</dir>
    <dir>C:\Users\Pete\Desktop\scanSee3.1\DATA</dir>
    <dir>C:\Users\Pete\Documents\eclipse\dc2mda\src</dir>
    <dir>C:\Users\Pete\Documents\eclipse\dc2mda\src opo</dir>
  </mrud>
</mda2idd_gui>

Items remembered between program sessions include:

  • window size and position
  • position of the sash thats plits the file list from the summary output
  • the list of most-recently-used directories (MRUD)
  • the first directory to show (the last directory from which an MDA file was selected)

Note

If more than one copy of this program is run by the same user at the same time, the content of the preferences file will be that of the latest action that forced an update to the file content.

OnAbout(event)[source]

show the “About” box

OnConvertAll(event)[source]

selected the “ConvertAll” menu item

OnMenuFileItemExit(event)[source]

User requested to quit the application

Parameters:event – wxPython event object
OnMenuFileItemPrefs(event)[source]

save the preferences to a file

OnMenuFileItemReportStyle(event)[source]
OnMenuFileItemSave(event)[source]

save the selected MDA file as ASCII

OnMrudItem(event)[source]

handle MRUD menu items

OnSashMoved(event)[source]

user moved the sash

OnSelectDirPicker(event)[source]

user changed the text or browsed to a directory in the picker

OnSelectTreeCtrlItem(event)[source]

user selected something in the directory list tree control

OnWindowGeometryChanged(event)[source]

user changed the window size or position

appendSummaryText(text)[source]

post new text to the summary TextCtrl, appending to any existing text

convertMdaDir(path)[source]

convert all MDA files in a given directory

getPreferences(start_fresh=False)[source]

set program preferences: default (start_fresh) and then optionally override from a file

listMdaFiles(path)[source]

return a list of all MDA files in the path directory

messageDialog(description, text)[source]

Present a dialog asking user to acknowledge something

Parameters:
  • description (str) – short description of message
  • text (str) – message to be shown
  • yes_and_no (bool) – if False (default), does not show a <No> button
readPreferences()[source]

read program prefs from a file

setCurrentDirectory(directory)[source]

set the current directory

setStatusText(text)[source]

post new text to the status bar

setSummaryText(text)[source]

post new text to the summary TextCtrl, clearing any existing text

update_mrud(newdir)[source]

MRUD: list of most-recently-used directories

update_mrud_menus()[source]

manage the MRUD menu items

writePreferences()[source]

save program prefs to a file

mda2idd_gui.main()[source]

presents the GUI