Exemple #1
0
 def setup(self):
     (options, self.args) = self.parser.parse_args()
     self._info['modname'] = options.module_name
     if self._info['modname'] is None:
         if len(self.args) >= 2:
             self._info['modname'] = self.args[1]
         else:
             self._info['modname'] = raw_input('Name of the new module: ')
     if not re.match('[a-zA-Z0-9_]+', self._info['modname']):
         print 'Invalid module name.'
         exit(2)
     self._dir = options.directory
     if self._dir == '.':
         self._dir = './oc-%s' % self._info['modname']
     try:
         os.stat(self._dir)
     except OSError:
         pass # This is what should happen
     else:
         print 'The given directory exists.'
         exit(2)
     if options.srcdir is None:
         options.srcdir = '/usr/local/share/ocvc/modtool/oc-newmod'
     self._srcdir = gr.prefs().get_string('modtool', 'newmod_path', options.srcdir)
     if not os.path.isdir(self._srcdir):
         print 'Error: Could not find oc-newmod source dir.'
         exit(2)
Exemple #2
0
    def __init__(self,tool="oc-ctrlport-monitor"):
        print "ControlPort Monitor running."
        self.started = False
        self.tool = tool
        atexit.register(self.shutdown)

        try:
            # setup export prefs
            gr.prefs().singleton().set_bool("ControlPort","on",True);
            if(tool == "oc-perf-monitorx"):
                gr.prefs().singleton().set_bool("ControlPort","edges_list",True);
                gr.prefs().singleton().set_bool("PerfCounters","on",True);
                gr.prefs().singleton().set_bool("PerfCounters","export",True);
        except:
            print "no support for gr.prefs setting"
Exemple #3
0
OpenCV Companion 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, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
"""

import os
import stat
from ocvc import gr

_oc_prefs = gr.prefs()

#setup paths
PATH_SEP = {'/':':', '\\':';'}[os.path.sep]
HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.occ_ocvc')
BLOCKS_DIRS = filter( #filter blank strings
    lambda x: x, PATH_SEP.join([
        os.environ.get('OCC_BLOCKS_PATH', ''),
        _oc_prefs.get_string('occ', 'local_blocks_path', ''),
        _oc_prefs.get_string('occ', 'global_blocks_path', ''),
    ]).split(PATH_SEP),
) + [HIER_BLOCKS_LIB_DIR]

#file creation modes
TOP_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH
HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH