to see a list of installation options you may want to configure.
+If you install Hooke, you should probably setup a system- or user-wide
+configuration file (:doc:`config`), and replace any relative paths
+with appropriate absolute paths. For example::
+
+ # Commands for managing a command stack (similar to macros).
+ [command_stack plugin]
+ # Directory containing command stack files.
+ path = resources/command_stack
+
+ # wxWindows graphical user interface.
+ [gui user interface]
+ # Path to the hooke icon image.
+ icon image = /usr/share/hooke/doc/img/microscope.ico
+ # Path to the Hooke splash screen image.
+ splash screen image = /usr/share/hooke/doc/img/hooke.jpg
+ # Directory containing perspective files.
+ perspective path = ~/.hooke/resources/gui/perspective
+
+
Running Hooke from the source directory
=======================================
params['output'] = 'default'
if params['output'] != None:
params['output'] = os.path.join(
- self.plugin.config['path'], params['output'])
+ os.path.expanduser(self.plugin.config['path']),
+ params['output'])
return params
class LoadCommand (CommandStackCommand):
params['input'] = 'default'
if params['input'] != None:
params['input'] = os.path.join(
- self.plugin.config['path'], params['input'])
+ os.path.expanduser(self.plugin.config['path']),
+ params['input'])
return params
:mod:`hooke.config` classes.
"""
+import os.path
from StringIO import StringIO
from ..command import Command, Argument, Failure
f = None
try:
if params['output'] != None:
- f = open(params['output'], 'w')
+ f = open(os.path.expanduser(params['output']), 'w')
hooke.config.write(fp=f)
finally:
if f != None:
"""
import copy
+import os.path
import re
import numpy
def _run(self, hooke, inqueue, outqueue, params):
data = self._block(hooke, params)
- with open(params['output'], 'w') as f:
+ with open(os.path.expanduser(params['output']), 'w') as f:
if params['header'] == True:
f.write('# %s \n' % ('\t'.join(data.info['columns'])))
numpy.savetxt(f, data, delimiter='\t')
:class:`CutCommand`.
"""
+import os.path
+
import numpy
from ..command import Command, Argument, Failure
cut_data = data[i_min:i_max+1,:] # slice rows from row-major data
# +1 to include data[i_max] row
- f = open(params['output'], 'w')
+ f = open(os.path.expanduser(params['output']), 'w')
if params['header'] == True:
f.write('# %s \n' % ('\t'.join(cut_data.info['columns'])))
numpy.savetxt(f, cut_data, delimiter='\t')
help=self.__doc__, plugin=plugin)
def _run(self, hooke, inqueue, outqueue, params):
- self._playlist(hooke, params).save(params['output'])
+ self._playlist(hooke, params).save(
+ os.path.expanduser(params['output']))
class LoadCommand (PlaylistAddingCommand):
help=self.__doc__, plugin=plugin)
def _run(self, hooke, inqueue, outqueue, params):
- p = load(path=params['input'], drivers=params['drivers'], hooke=hooke)
+ p = load(os.path.expanduser(path=params['input']),
+ drivers=params['drivers'], hooke=hooke)
self._set_playlist(hooke, params, p)
outqueue.put(p)
def _run(self, hooke, inqueue, outqueue, params):
self._playlist(hooke, params).append_curve_by_path(
- params['input'], params['info'], hooke=hooke)
+ os.path.expanduser(params['input']), params['info'], hooke=hooke)
class AddGlobCommand (PlaylistCommand):
lists of :class:`hooke.playlist.Playlist` classes.
"""
+import os.path
+
from ..command import Command, Argument, Failure
from ..playlist import FilePlaylist
from . import Builtin
def _run(self, hooke, inqueue, outqueue, params):
p = FilePlaylist(
drivers=hooke.drivers,
- path=params['file'],
+ path=os.path.expanduser(params['file']),
)
self._set_playlist(hooke, params, p)
outqueue.put(p)
self._perspectives = {} # {name: perspective_str}
self._c = {}
- self.SetIcon(wx.Icon(self.gui.config['icon image'], wx.BITMAP_TYPE_ICO))
+ self.SetIcon(wx.Icon(
+ os.path.expanduser(self.gui.config['icon image']),
+ wx.BITMAP_TYPE_ICO))
# setup frame manager
self._c['manager'] = aui.AuiManager()
self._perspectives = {
'Default': self._c['manager'].SavePerspective(),
}
- path = self.gui.config['perspective path']
+ path = os.path.expanduser(self.gui.config['perspective path'])
if os.path.isdir(path):
files = sorted(os.listdir(path))
for fname in files:
if name == 'Default':
name = 'New perspective'
name = select_save_file(
- directory=self.gui.config['perspective path'],
+ directory=os.path.expanduser(self.gui.config['perspective path']),
name=name,
extension=self.gui.config['perspective extension'],
parent=self,
if name == None:
return
self._save_perspective(
- perspective, self.gui.config['perspective path'], name=name,
+ perspective,
+ os.path.expanduser(self.gui.config['perspective path']), name=name,
extension=self.gui.config['perspective extension'])
def _on_delete_perspective(self, *args, **kwargs):
names = [options[i] for i in dialog.selected]
dialog.Destroy()
self._delete_perspectives(
- self.gui.config['perspective path'], names=names,
- extension=self.gui.config['perspective extension'])
+ os.path.expanduser(self.gui.config['perspective path']),
+ names=names, extension=self.gui.config['perspective extension'])
def _on_select_perspective(self, _class, method, name):
self._restore_perspective(name)
def _setup_splash_screen(self):
if self.gui.config['show splash screen'] == True:
- path = self.gui.config['splash screen image']
+ path = os.path.expanduser(self.gui.config['splash screen image'])
if os.path.isfile(path):
duration = self.gui.config['splash screen duration']
wx.SplashScreen(