Project saving and opening.
This commit is contained in:
parent
deac0a7ef6
commit
8bcaa65529
11
camlib.py
11
camlib.py
|
@ -124,9 +124,7 @@ class Geometry:
|
|||
def to_dict(self):
|
||||
"""
|
||||
Returns a respresentation of the object as a dictionary.
|
||||
``self.solid_geometry`` has been converted using the ``to_dict``
|
||||
function. Attributes to include are listed in
|
||||
``self.ser_attrs``.
|
||||
Attributes to include are listed in ``self.ser_attrs``.
|
||||
|
||||
:return: A dictionary-encoded copy of the object.
|
||||
:rtype: dict
|
||||
|
@ -137,7 +135,12 @@ class Geometry:
|
|||
return d
|
||||
|
||||
def from_dict(self, d):
|
||||
return
|
||||
"""
|
||||
Sets object's attributes from a dictionary.
|
||||
Attributes to include are listed in ``self.ser_attrs``.
|
||||
"""
|
||||
for attr in self.ser_attrs:
|
||||
setattr(self, attr, d[attr])
|
||||
|
||||
|
||||
class Gerber (Geometry):
|
||||
|
|
150
cirkuix.py
150
cirkuix.py
|
@ -79,7 +79,7 @@ class CirkuixObj:
|
|||
Reads form into ``self.options``.
|
||||
|
||||
:return: None
|
||||
:rtype : None
|
||||
:rtype: None
|
||||
"""
|
||||
for option in self.options:
|
||||
self.read_form_item(option)
|
||||
|
@ -89,7 +89,7 @@ class CirkuixObj:
|
|||
Sets up the UI/form for this object.
|
||||
|
||||
:return: None
|
||||
:rtype : None
|
||||
:rtype: None
|
||||
"""
|
||||
|
||||
# Where the UI for this object is drawn
|
||||
|
@ -232,7 +232,7 @@ class CirkuixGerber(CirkuixObj, Gerber):
|
|||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
# from predecessors.
|
||||
self.ser_attrs += ['options']
|
||||
self.ser_attrs += ['options', 'kind']
|
||||
|
||||
def convert_units(self, units):
|
||||
factor = Gerber.convert_units(self, units)
|
||||
|
@ -313,7 +313,7 @@ class CirkuixExcellon(CirkuixObj, Excellon):
|
|||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
# from predecessors.
|
||||
self.ser_attrs += ['options']
|
||||
self.ser_attrs += ['options', 'kind']
|
||||
|
||||
def convert_units(self, units):
|
||||
factor = Excellon.convert_units(self, units)
|
||||
|
@ -393,7 +393,7 @@ class CirkuixCNCjob(CirkuixObj, CNCjob):
|
|||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
# from predecessors.
|
||||
self.ser_attrs += ['options']
|
||||
self.ser_attrs += ['options', 'kind']
|
||||
|
||||
def plot(self, figure):
|
||||
CirkuixObj.plot(self, figure)
|
||||
|
@ -444,7 +444,7 @@ class CirkuixGeometry(CirkuixObj, Geometry):
|
|||
# Attributes to be included in serialization
|
||||
# Always append to it because it carries contents
|
||||
# from predecessors.
|
||||
self.ser_attrs += ['options']
|
||||
self.ser_attrs += ['options', 'kind']
|
||||
|
||||
def scale(self, factor):
|
||||
if type(self.solid_geometry) == list:
|
||||
|
@ -515,10 +515,10 @@ class App:
|
|||
|
||||
def __init__(self):
|
||||
"""
|
||||
Starts the application and the Gtk.main().
|
||||
Starts the application.
|
||||
|
||||
@return: app
|
||||
@rtype: App
|
||||
:return: app
|
||||
:rtype: App
|
||||
"""
|
||||
|
||||
# Needed to interact with the GUI from other threads.
|
||||
|
@ -555,10 +555,10 @@ class App:
|
|||
self.canvas = None
|
||||
self.setup_plot()
|
||||
|
||||
self.setup_project_list()
|
||||
self.setup_component_editor()
|
||||
self.setup_project_list() # The "Project" tab
|
||||
self.setup_component_editor() # The "Selected" tab
|
||||
|
||||
## DATA ##
|
||||
#### DATA ####
|
||||
self.setup_obj_classes()
|
||||
self.stuff = {} # CirkuixObj's by name
|
||||
self.mouse = None # Mouse coordinates over plot
|
||||
|
@ -574,7 +574,10 @@ class App:
|
|||
self.defaults = {
|
||||
"units": "in"
|
||||
} # Application defaults
|
||||
|
||||
## Current Project ##
|
||||
self.options = {} # Project options
|
||||
self.project_filename = None
|
||||
|
||||
self.form_kinds = {
|
||||
"units": "radio"
|
||||
|
@ -838,7 +841,14 @@ class App:
|
|||
"""
|
||||
|
||||
value = self.builder.get_object(widget_name).get_text()
|
||||
return eval(value)
|
||||
if value == "":
|
||||
value = "None"
|
||||
try:
|
||||
evald = eval(value)
|
||||
return evald
|
||||
except:
|
||||
self.info("Could not evaluate: " + value)
|
||||
return None
|
||||
|
||||
def set_list_selection(self, name):
|
||||
"""
|
||||
|
@ -1077,9 +1087,10 @@ class App:
|
|||
def options2form(self):
|
||||
"""
|
||||
Sets the 'Project Options' or 'Application Defaults' form with values from
|
||||
``self.options``or ``self.defaults``.
|
||||
:return : None
|
||||
:rtype : None
|
||||
``self.options`` or ``self.defaults``.
|
||||
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
|
||||
# Set the on-change callback to do nothing while we do the changes.
|
||||
|
@ -1133,11 +1144,18 @@ class App:
|
|||
def save_project(self, filename):
|
||||
"""
|
||||
Saves the current project to the specified file.
|
||||
|
||||
:param filename: Name of the file in which to save.
|
||||
:type filename: str
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Captura the latest changes
|
||||
try:
|
||||
self.get_current().read_form()
|
||||
except:
|
||||
pass
|
||||
|
||||
d = {"objs": [self.stuff[o].to_dict() for o in self.stuff],
|
||||
"options": self.options}
|
||||
|
||||
|
@ -1156,24 +1174,106 @@ class App:
|
|||
|
||||
f.close()
|
||||
|
||||
def open_project(self, filename):
|
||||
"""
|
||||
Loads a project from the specified file.
|
||||
|
||||
:param filename: Name of the file from which to load.
|
||||
:type filename: str
|
||||
:return: None
|
||||
"""
|
||||
|
||||
try:
|
||||
f = open(filename, 'r')
|
||||
except:
|
||||
print "WARNING: Failed to open project file:", filename
|
||||
return
|
||||
|
||||
try:
|
||||
d = json.load(f, object_hook=dict2obj)
|
||||
except:
|
||||
print "WARNING: Failed to parse project file:", filename
|
||||
f.close()
|
||||
|
||||
# Clear the current project
|
||||
self.on_file_new(None)
|
||||
|
||||
# Project options
|
||||
self.options.update(d['options'])
|
||||
self.project_filename = filename
|
||||
|
||||
# Re create objects
|
||||
for obj in d['objs']:
|
||||
def obj_init(obj_inst, app_inst):
|
||||
obj_inst.from_dict(obj)
|
||||
self.new_object(obj['kind'], obj['options']['name'], obj_init)
|
||||
|
||||
self.info("Project loaded from: " + filename)
|
||||
|
||||
########################################
|
||||
## EVENT HANDLERS ##
|
||||
########################################
|
||||
def on_file_openproject(self, param):
|
||||
"""
|
||||
Callback for menu item File->Open Project. Opens a file chooser and calls
|
||||
``self.open_project()`` after successful selection of a filename.
|
||||
|
||||
:param param: Ignored.
|
||||
:return: None
|
||||
"""
|
||||
def on_success(app_obj, filename):
|
||||
app_obj.open_project(filename)
|
||||
|
||||
self.file_chooser_action(on_success)
|
||||
|
||||
def on_file_saveproject(self, param):
|
||||
return
|
||||
"""
|
||||
Callback for menu item File->Save Project. Saves the project to
|
||||
``self.project_filename`` or calls ``self.on_file_saveprojectas()``
|
||||
if set to None. The project is saved by calling ``self.save_project()``.
|
||||
|
||||
:param param: Ignored.
|
||||
:return: None
|
||||
"""
|
||||
if self.project_filename is None:
|
||||
self.on_file_saveprojectas(None)
|
||||
else:
|
||||
self.save_project(self.project_filename)
|
||||
self.info("Project saved to: " + self.project_filename)
|
||||
|
||||
def on_file_saveprojectas(self, param):
|
||||
"""
|
||||
Callback for menu item File->Save Project As... Opens a file
|
||||
chooser and saves the project to the given file via
|
||||
``self.save_project()``.
|
||||
|
||||
:param param: Ignored.
|
||||
:return: None
|
||||
"""
|
||||
def on_success(app_obj, filename):
|
||||
assert isinstance(app_obj, App)
|
||||
app_obj.save_project(filename)
|
||||
self.project_filename = filename
|
||||
app_obj.info("Project saved to: " + filename)
|
||||
|
||||
self.file_chooser_save_action(on_success)
|
||||
return
|
||||
|
||||
def on_file_saveprojectcopy(self, param):
|
||||
return
|
||||
"""
|
||||
Callback for menu item File->Save Project Copy... Opens a file
|
||||
chooser and saves the project to the given file via
|
||||
``self.save_project``. It does not update ``self.project_filename`` so
|
||||
subsequent save requests are done on the previous known filename.
|
||||
|
||||
:param param: Ignore.
|
||||
:return: None
|
||||
"""
|
||||
def on_success(app_obj, filename):
|
||||
assert isinstance(app_obj, App)
|
||||
app_obj.save_project(filename)
|
||||
app_obj.info("Project copy saved to: " + filename)
|
||||
|
||||
self.file_chooser_save_action(on_success)
|
||||
|
||||
def on_options_app2project(self, param):
|
||||
"""
|
||||
|
@ -1274,7 +1374,7 @@ class App:
|
|||
def on_file_savedefaults(self, param):
|
||||
"""
|
||||
Callback for menu item File->Save Defaults. Saves application default options
|
||||
(``self.defaults``) to defaults.json.
|
||||
``self.defaults`` to defaults.json.
|
||||
|
||||
:param param: Ignored.
|
||||
:return: None
|
||||
|
@ -1779,7 +1879,9 @@ class App:
|
|||
|
||||
print "You selected", model[treeiter][0]
|
||||
self.selected_item_name = model[treeiter][0]
|
||||
GLib.idle_add(lambda: self.get_current().build_ui())
|
||||
obj_new = self.get_current()
|
||||
if obj_new is not None:
|
||||
GLib.idle_add(lambda: obj_new.build_ui())
|
||||
else:
|
||||
print "Nothing selected"
|
||||
self.selected_item_name = None
|
||||
|
@ -1807,7 +1909,11 @@ class App:
|
|||
#self.tree_select.unselect_all()
|
||||
self.build_list()
|
||||
|
||||
#print "File->New not implemented yet."
|
||||
# Clear project filename
|
||||
self.project_filename = None
|
||||
|
||||
# Re-fresh project options
|
||||
self.on_options_app2project(None)
|
||||
|
||||
def on_filequit(self, param):
|
||||
"""
|
||||
|
|
31
cirkuix.ui
31
cirkuix.ui
|
@ -41,6 +41,11 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-save-as</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-open</property>
|
||||
</object>
|
||||
<object class="GtkOffscreenWindow" id="offscrwindow_cncjob">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
|
@ -2062,14 +2067,13 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem5">
|
||||
<property name="label" translatable="yes">Save defaults</property>
|
||||
<object class="GtkImageMenuItem" id="imagemenuitem11">
|
||||
<property name="label" translatable="yes">Open Project ...</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Saves the application's default options to file.</property>
|
||||
<property name="image">image4</property>
|
||||
<property name="image">image9</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_file_savedefaults" swapped="no"/>
|
||||
<signal name="activate" handler="on_file_openproject" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -2108,6 +2112,23 @@
|
|||
<signal name="activate" handler="on_file_saveprojectcopy" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImageMenuItem" id="menuitem5">
|
||||
<property name="label" translatable="yes">Save defaults</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Saves the application's default options to file.</property>
|
||||
<property name="image">image4</property>
|
||||
<property name="use_stock">False</property>
|
||||
<signal name="activate" handler="on_file_savedefaults" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorMenuItem" id="separatormenuitem3">
|
||||
<property name="visible">True</property>
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"cncjob_multicolored": false, "geometry_paintoverlap": 0.15, "geometry_plot": true, "cncjob_solid": false, "excellon_feedrate": 5.0, "gerber_plot": true, "gerber_mergepolys": true, "excellon_drillz": -0.1, "geometry_feedrate": 5.0, "units": "IN", "excellon_travelz": 0.1, "gerber_multicolored": false, "gerber_solid": false, "excellon_plot": true, "gerber_isotooldia": 0.016, "cncjob_tooldia": 0.16, "geometry_travelz": 0.1, "gerber_cutoutmargin": 0.2, "excellon_solid": false, "geometry_paintmargin": 0.01, "geometry_cutz": -0.002, "geometry_cnctooldia": 0.16, "geometry_painttooldia": 0.0625, "gerber_gaps": "4", "excellon_multicolored": false, "gerber_bboxmargin": 0.0, "cncjob_plot": true, "gerber_cutoutgapsize": 0.15, "gerber_bboxrounded": false, "geometry_multicolored": false, "gerber_noncoppermargin": 0.0, "geometry_solid": false}
|
||||
{"cncjob_multicolored": false, "geometry_paintoverlap": 0.15, "geometry_plot": true, "cncjob_solid": false, "gerber_isotooldia": 0.016, "gerber_plot": true, "gerber_mergepolys": true, "gerber_cutoutgapsize": 0.15, "geometry_feedrate": 5.0, "units": "IN", "excellon_travelz": 0.1, "gerber_multicolored": false, "gerber_solid": false, "excellon_plot": true, "excellon_feedrate": 5.0, "cncjob_tooldia": 0.016, "geometry_travelz": 0.1, "gerber_cutoutmargin": 0.2, "excellon_solid": false, "geometry_paintmargin": 0.01, "geometry_cutz": -0.002, "gerber_noncoppermargin": 0.0, "gerber_gaps": "4", "excellon_multicolored": false, "geometry_painttooldia": 0.0625, "cncjob_plot": true, "excellon_drillz": -0.1, "gerber_bboxrounded": false, "geometry_multicolored": false, "geometry_cnctooldia": 0.016, "geometry_solid": false, "gerber_bboxmargin": 0.0}
|
Binary file not shown.
Binary file not shown.
|
@ -130,6 +130,7 @@
|
|||
| <a href="#P"><strong>P</strong></a>
|
||||
| <a href="#R"><strong>R</strong></a>
|
||||
| <a href="#S"><strong>S</strong></a>
|
||||
| <a href="#T"><strong>T</strong></a>
|
||||
| <a href="#Z"><strong>Z</strong></a>
|
||||
|
||||
</div>
|
||||
|
@ -266,16 +267,20 @@
|
|||
<dt><a href="index.html#cirkuix.App.file_chooser_save_action">file_chooser_save_action() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.Gerber.fix_regions">fix_regions() (cirkuix.Gerber method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.Gerber.fraction">fraction (cirkuix.Gerber attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.Geometry.from_dict">from_dict() (cirkuix.Geometry method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
|
@ -411,10 +416,26 @@
|
|||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_file_openproject">on_file_openproject() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_file_savedefaults">on_file_savedefaults() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_file_saveproject">on_file_saveproject() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_file_saveprojectas">on_file_saveprojectas() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_file_saveprojectcopy">on_file_saveprojectcopy() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_fileopenexcellon">on_fileopenexcellon() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
@ -446,12 +467,12 @@
|
|||
<dt><a href="index.html#cirkuix.App.on_generate_isolation">on_generate_isolation() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_generate_paintarea">on_generate_paintarea() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.on_gerber_generate_cutout">on_gerber_generate_cutout() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
@ -533,6 +554,10 @@
|
|||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.open_project">open_project() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.options2form">options2form() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
@ -613,6 +638,10 @@
|
|||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.save_project">save_project() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="index.html#cirkuix.CNCjob.scale">scale() (cirkuix.CNCjob method)</a>
|
||||
</dt>
|
||||
|
||||
|
@ -638,6 +667,12 @@
|
|||
<dt><a href="index.html#cirkuix.App.set_form_item">set_form_item() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.CirkuixObj.set_form_item">(cirkuix.CirkuixObj method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></dd>
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.set_list_selection">set_list_selection() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
@ -646,12 +681,12 @@
|
|||
<dt><a href="index.html#cirkuix.App.set_progress_bar">set_progress_bar() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.CirkuixObj.setup_axes">setup_axes() (cirkuix.CirkuixObj method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.App.setup_component_editor">setup_component_editor() (cirkuix.App method)</a>
|
||||
</dt>
|
||||
|
@ -675,6 +710,22 @@
|
|||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="T">T</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.Geometry.to_dict">to_dict() (cirkuix.Geometry method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="index.html#cirkuix.CirkuixObj.to_form">to_form() (cirkuix.CirkuixObj method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="Z">Z</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
|
|
@ -518,10 +518,10 @@ startup state.</p>
|
|||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_file_savedefaults">
|
||||
<tt class="descname">on_file_savedefaults</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_savedefaults" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Save Defaults. Saves application default options
|
||||
(<tt class="docutils literal"><span class="pre">self.defaults</span></tt>) to defaults.json.</p>
|
||||
<dt id="cirkuix.App.on_file_openproject">
|
||||
<tt class="descname">on_file_openproject</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_openproject" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Open Project. Opens a file chooser and calls
|
||||
<tt class="docutils literal"><span class="pre">self.open_project()</span></tt> after successful selection of a filename.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
|
@ -534,6 +534,78 @@ startup state.</p>
|
|||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_file_savedefaults">
|
||||
<tt class="descname">on_file_savedefaults</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_savedefaults" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Save Defaults. Saves application default options
|
||||
<tt class="docutils literal"><span class="pre">self.defaults</span></tt> to defaults.json.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>param</strong> – Ignored.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_file_saveproject">
|
||||
<tt class="descname">on_file_saveproject</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_saveproject" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Save Project. Saves the project to
|
||||
<tt class="docutils literal"><span class="pre">self.project_filename</span></tt> or calls <tt class="docutils literal"><span class="pre">self.on_file_saveprojectas()</span></tt>
|
||||
if set to None. The project is saved by calling <tt class="docutils literal"><span class="pre">self.save_project()</span></tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>param</strong> – Ignored.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_file_saveprojectas">
|
||||
<tt class="descname">on_file_saveprojectas</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_saveprojectas" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Save Project As... Opens a file
|
||||
chooser and saves the project to the given file via
|
||||
<tt class="docutils literal"><span class="pre">self.save_project()</span></tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>param</strong> – Ignored.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_file_saveprojectcopy">
|
||||
<tt class="descname">on_file_saveprojectcopy</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_file_saveprojectcopy" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Callback for menu item File->Save Project Copy... Opens a file
|
||||
chooser and saves the project to the given file via
|
||||
<tt class="docutils literal"><span class="pre">self.save_project</span></tt>. It does not update <tt class="docutils literal"><span class="pre">self.project_filename</span></tt> so
|
||||
subsequent save requests are done on the previous known filename.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>param</strong> – Ignore.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.on_fileopenexcellon">
|
||||
<tt class="descname">on_fileopenexcellon</tt><big>(</big><em>param</em><big>)</big><a class="headerlink" href="#cirkuix.App.on_fileopenexcellon" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -1063,13 +1135,37 @@ toolbar button or the ‘2’ key when the canvas is focused. Calls <tt
|
|||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.open_project">
|
||||
<tt class="descname">open_project</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#cirkuix.App.open_project" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Loads a project from the specified file.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – Name of the file from which to load.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.options2form">
|
||||
<tt class="descname">options2form</tt><big>(</big><big>)</big><a class="headerlink" href="#cirkuix.App.options2form" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sets the ‘Project Options’ or ‘Application Defaults’ form with values from
|
||||
<tt class="docutils literal"><span class="pre">self.options``or</span> <span class="pre">``self.defaults</span></tt>.
|
||||
:return : None
|
||||
:rtype : None</p>
|
||||
<tt class="docutils literal"><span class="pre">self.options</span></tt> or <tt class="docutils literal"><span class="pre">self.defaults</span></tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -1125,6 +1221,22 @@ saves it to the corresponding dictionary.</p>
|
|||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.save_project">
|
||||
<tt class="descname">save_project</tt><big>(</big><em>filename</em><big>)</big><a class="headerlink" href="#cirkuix.App.save_project" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Saves the current project to the specified file.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>filename</strong> (<em>str</em>) – Name of the file in which to save.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.App.set_form_item">
|
||||
<tt class="descname">set_form_item</tt><big>(</big><em>name</em>, <em>value</em><big>)</big><a class="headerlink" href="#cirkuix.App.set_form_item" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -1312,6 +1424,13 @@ the geometry appropriately.</p>
|
|||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.Geometry.from_dict">
|
||||
<tt class="descname">from_dict</tt><big>(</big><em>d</em><big>)</big><a class="headerlink" href="#cirkuix.Geometry.from_dict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sets object’s attributes from a dictionary.
|
||||
Attributes to include are listed in <tt class="docutils literal"><span class="pre">self.ser_attrs</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.Geometry.get_empty_area">
|
||||
<tt class="descname">get_empty_area</tt><big>(</big><em>boundary=None</em><big>)</big><a class="headerlink" href="#cirkuix.Geometry.get_empty_area" title="Permalink to this definition">¶</a></dt>
|
||||
|
@ -1345,6 +1464,23 @@ this method.
|
|||
bounds of geometry.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.Geometry.to_dict">
|
||||
<tt class="descname">to_dict</tt><big>(</big><big>)</big><a class="headerlink" href="#cirkuix.Geometry.to_dict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a respresentation of the object as a dictionary.
|
||||
Attributes to include are listed in <tt class="docutils literal"><span class="pre">self.ser_attrs</span></tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A dictionary-encoded copy of the object.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">dict</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
|
@ -1694,9 +1830,17 @@ by the user in their respective forms.</p>
|
|||
<dl class="method">
|
||||
<dt id="cirkuix.CirkuixObj.build_ui">
|
||||
<tt class="descname">build_ui</tt><big>(</big><big>)</big><a class="headerlink" href="#cirkuix.CirkuixObj.build_ui" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sets up the UI/form for this object.
|
||||
@return: None
|
||||
@rtype : None</p>
|
||||
<dd><p>Sets up the UI/form for this object.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -1718,8 +1862,17 @@ clears them. Descendants must do the actual plotting.</p>
|
|||
<dl class="method">
|
||||
<dt id="cirkuix.CirkuixObj.read_form">
|
||||
<tt class="descname">read_form</tt><big>(</big><big>)</big><a class="headerlink" href="#cirkuix.CirkuixObj.read_form" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Reads form into self.options
|
||||
@rtype : None</p>
|
||||
<dd><p>Reads form into <tt class="docutils literal"><span class="pre">self.options</span></tt>.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
|
@ -1731,15 +1884,54 @@ it can be later exported as JSON. Override this method.
|
|||
@rtype: dict</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.CirkuixObj.set_form_item">
|
||||
<tt class="descname">set_form_item</tt><big>(</big><em>option</em><big>)</big><a class="headerlink" href="#cirkuix.CirkuixObj.set_form_item" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Copies the specified options to the UI form.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>option</strong> (<em>str</em>) – Name of the option (Key in <tt class="docutils literal"><span class="pre">self.options</span></tt>).</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.CirkuixObj.setup_axes">
|
||||
<tt class="descname">setup_axes</tt><big>(</big><em>figure</em><big>)</big><a class="headerlink" href="#cirkuix.CirkuixObj.setup_axes" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>1) Creates axes if they don’t exist. 2) Clears axes. 3) Attaches
|
||||
them to figure if not part of the figure. 4) Sets transparent
|
||||
background. 5) Sets 1:1 scale aspect ratio.
|
||||
@param figure: A Matplotlib.Figure on which to add/configure axes.
|
||||
@type figure: matplotlib.figure.Figure
|
||||
@return: None</p>
|
||||
background. 5) Sets 1:1 scale aspect ratio.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>figure</strong> (<em>matplotlib.figure.Figure</em>) – A Matplotlib.Figure on which to add/configure axes.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="cirkuix.CirkuixObj.to_form">
|
||||
<tt class="descname">to_form</tt><big>(</big><big>)</big><a class="headerlink" href="#cirkuix.CirkuixObj.to_form" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Copies options to the UI form.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">None</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue