rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
elif len(args) == 5:
elif len(args) in (5, 6):
def __call__(self, *args): if len(args) == 9: return _draw.draw_bezier(self, *args) elif len(args) == 5: try: a = args[0] b = args[1] c = args[2] d = args[3] value = args[4] return _draw.draw_bezier(self, a.y, a.x, b.y, b.x, c.y, c.x, d.y, d.x, value) except KeyError, AttributeError: pass raise ValueError("Arguments ar...
c.y, c.x, d.y, d.x, value)
c.y, c.x, d.y, d.x, value, accuracy)
def __call__(self, *args): if len(args) == 9: return _draw.draw_bezier(self, *args) elif len(args) == 5: try: a = args[0] b = args[1] c = args[2] d = args[3] value = args[4] return _draw.draw_bezier(self, a.y, a.x, b.y, b.x, c.y, c.x, d.y, d.x, value) except KeyError, AttributeError: pass raise ValueError("Arguments ar...
del RGBPixel
def __call__(self, *args): if len(args) == 3: return _draw.flood_fill(self, *args) elif len(args) == 2: try: a = args[0] value = args[1] return _draw.flood_fill(self, a.y, a.x, value) except KeyError, AttributeError: pass raise ValueError("Arguments are incorrect.")
for i in range(len(self.highlighted)):
for i in range(last_one, len(self.highlighted)):
def clear_highlight_cc(self, ccs): if not util.is_sequence(ccs): ccs = (ccs,) for cc in ccs: for i in range(len(self.highlighted)): if (self.highlighted[i][0][0] == cc.page_offset_x() and self.highlighted[i][0][1] == cc.page_offset_y()): del self.highlighted[i] self.PaintArea(cc.page_offset_x(), cc.page_offset_y(), cc....
if self.scaling <= 1: for highlight in old_highlighted: self.PaintArea(*highlight[0]) if self.scaling > 1: self.Refresh(0, rect=wxRect(0,0,self.GetSize().x,self.GetSize().y))
self.Refresh(0, rect=wxRect(0,0,self.GetSize().x,self.GetSize().y))
def clear_all_highlights(self): old_highlighted = self.highlighted[:] self.highlighted = [] if self.scaling <= 1: for highlight in old_highlighted: self.PaintArea(*highlight[0]) if self.scaling > 1: self.Refresh(0, rect=wxRect(0,0,self.GetSize().x,self.GetSize().y))
w = self.width * scale - 1 h = self.height * scale - 1
w = self.image.width * scale h = self.image.height * scale
def scale(self, scale=None): scroll_amount = self.scroll_amount scaling = self.scaling if scale == None: scale = scaling w = self.width * scale - 1 h = self.height * scale - 1 origin = [x * self.scroll_amount for x in self.GetViewStart()] x = max(min(origin[0] * scale / scaling + 1, w - self.GetSize().x) - 2, 0) y = ma...
origin = [x * self.scroll_amount for x in self.GetViewStart()] origin_scaled = [x / scaling for x in origin] update_regions = self.GetUpdateRegion() rects = wxRegionIterator(update_regions) while rects.HaveRects(): ox = rects.GetX() / scaling oy = rects.GetY() / scaling x = ox + origin_scaled[0] y = oy + origin_scaled...
if scaling == 1: origin = [x * self.scroll_amount for x in self.GetViewStart()] update_regions = self.GetUpdateRegion() rects = wxRegionIterator(update_regions) while rects.HaveRects(): ox = rects.GetX() oy = rects.GetY() x = ox + origin[0] y = oy + origin[1] if (x > self.image.lr_x or y > self.image.lr_y or x < self....
def OnPaint(self, event): if not self.image: return scaling = self.scaling origin = [x * self.scroll_amount for x in self.GetViewStart()] origin_scaled = [x / scaling for x in origin] update_regions = self.GetUpdateRegion() rects = wxRegionIterator(update_regions) # Paint only where wxWindows tells us to, this is faste...
if (y + h >= self.height): h = self.image.nrows - y - 2 if (x + w >= self.width): w = self.image.ncols - x - 2
if (y + h >= self.image.lr_y): h = self.image.lr_y - y - 2 if (x + w >= self.image.lr_x): w = self.image.lr_x - x - 2
def PaintArea(self, x, y, w, h, check=1): dc = wxPaintDC(self) dc.SetLogicalFunction(wxCOPY) scaling = self.scaling origin = [a * self.scroll_amount for a in self.GetViewStart()] origin_scaled = [a / scaling for a in origin] size_scaled = [a / scaling for a in self.GetSizeTuple()] if check: if ((x + w < origin_scaled[0...
image = wxEmptyImage(w + 1, h + 1)
def PaintArea(self, x, y, w, h, check=1): dc = wxPaintDC(self) dc.SetLogicalFunction(wxCOPY) scaling = self.scaling origin = [a * self.scroll_amount for a in self.GetViewStart()] origin_scaled = [a / scaling for a in origin] size_scaled = [a / scaling for a in self.GetSizeTuple()] if check: if ((x + w < origin_scaled[0...
apply(self.scaled_to_string_function, (subimage, scaling, image.GetDataBuffer()))
image = wxEmptyImage(w * scaling, h * scaling) apply(self.scaled_to_string_function, (subimage, scaling, image.GetDataBuffer()))
def PaintArea(self, x, y, w, h, check=1): dc = wxPaintDC(self) dc.SetLogicalFunction(wxCOPY) scaling = self.scaling origin = [a * self.scroll_amount for a in self.GetViewStart()] origin_scaled = [a / scaling for a in origin] size_scaled = [a / scaling for a in self.GetSizeTuple()] if check: if ((x + w < origin_scaled[0...
return "%s.display()" % self.name
return "%s.display()" % self.label
def double_click(self): return "%s.display()" % self.name
return _guiClass.determine_choices(self, locals)
return Class.determine_choices(self, locals)
def determine_choices(self, locals): from gamera import core self.klass = core.Region return _guiClass.determine_choices(self, locals)
return _guiClass.determine_choices(self, locals)
return Class.determine_choices(self, locals)
def determine_choices(self, locals): from gamera import core self.klass = core.RegionMap return _guiClass.determine_choices(self, locals)
return _guiClass.determine_choices(self, locals)
return Class.determine_choices(self, locals)
def determine_choices(self, locals): from gamera import core self.klass = core.ImageInfo return _guiClass.determine_choices(self, locals)
return _guiClass.determine_choices(self, locals)
return Class.determine_choices(self, locals)
def determine_choices(self, locals): from gamera import core self.klass = core.ImageBase return _guiClass.determine_choices(self, locals)
return _guiClass.determine_choices(self, locals)
return Class.determine_choices(self, locals)
def determine_choices(self, locals): from gamera import core self.klass = core.Point return _guiClass.determine_choices(self, locals)
a list of glyphs that is already updated for splitting."""
a list of glyphs that is already updated based on splitting."""
def classify_and_update_list_automatic(self, glyphs, *args, **kwargs): """**classify_and_update_list_automatic** (ImageList *glyphs*, Int
flags |= wxMULTIPLE
self._flags |= wxMULTIPLE
def __init__(self, parent, extensions="*.*", multiple=0): cls = self.__class__ if cls.last_directory is None: cls.last_directory = config.get("default_dir") if multiple: flags |= wxMULTIPLE self._multiple = True else: self._multiple = False wxFileDialog.__init__( self, parent, "Choose a file", cls.last_directory, "", e...
show_plot(figure)
show_figure(figure)
def plot(*args): figure = Figure() axis = figure.add_subplot(111) axis.plot(*args) show_plot(figure) return figure
**draw_hollow_rect** (Point(*x1*, *y1*), Point(*x2*, *y2))
**draw_hollow_rect** (Point(*x1*, *y1*), Point(*x2*, *y2*))
def __doc_example1__(images): from random import randint from gamera.core import Image image = Image(0, 0, 100, 100, RGB, DENSE) for i in range(10): image.draw_line(randint(0, 100), randint(0, 100), randint(0, 100), randint(0, 100), RGBPixel(randint(0, 255), randint(0,255), randint(0, 255))) return image
for file in config.get("execfile"): try: self.shell.push("execfile(%s)" % repr(file)) except Exception, e: exc_type, exc_value, exc_traceback = sys.exc_info() gui_util.message("Error importing file '%s':\n%s" % (file, "".join(traceback.format_exception( exc_type, exc_value, exc_traceback))))
execfiles = config.get("execfile") if execfiles is not None: for file in execfiles: try: self.shell.run("execfile(%s)" % repr(file)) except Exception, e: exc_type, exc_value, exc_traceback = sys.exc_info() gui_util.message("Error importing file '%s':\n%s" % (file, "".join(traceback.format_exception( exc_type, exc_value...
def import_command_line_modules(self): for file in config.get_free_args(): try: name = os.path.basename(file)[:-3] module = imp.load_source(name, file) self.shell.locals[name] = module self.shell.push(name) imported = True except Exception, e: exc_type, exc_value, exc_traceback = sys.exc_info() gui_util.message("Error ...
splits = getattr(glyph, parts[1]).__call__(glyph)
if sys.version_info[:2] < (2, 4): splits = getattr(glyph, parts[1]).__call__(glyph) else: splits = getattr(glyph, parts[1]).__call__()
def _do_splits_impl(self, glyph): id = glyph.get_main_id() if (id.startswith('_split.')): parts = id.split('.') if (len(parts) != 2 or not hasattr(glyph, parts[1])): raise ClassifierError("'%s' is not a known or valid split function." % parts[1]) try: splits = getattr(glyph, parts[1]).__call__(glyph) except core.Segmen...
progress = gamera.util.ProgressFactory("Generating features...", len(list))
progress = util.ProgressFactory("Generating features...", len(list))
def generate_features(self, glyphs): """Generates features for all the given glyphs.""" progress = gamera.util.ProgressFactory("Generating features...", len(list)) try: for glyph in list: glyph.generate_features(self.feature_functions) progress.step() finally: progress.kill()
update = kill = step = add_length = ___
update = kill = step = add_length = set_length = ___
def ___(*args): pass
config.config.add_option( "-p", "--progress-bars", default=False, help="[console] Display textual progress bars on stdout")
def update(self, num, den): if self._starting: sys.stdout.write(self._message) sys.stdout.write("\n") self._starting = 0 if not self._done: progress = int((float(num) / float(den)) * self.width) if progress != self._last_amount: self._last_amount = progress left = self.width - progress sys.stdout.write("|") sys.stdout....
elif config.config.get("progress_bars"):
elif config.get("progress_bar"):
def ProgressFactory(message, length=1): if has_gui.gui != None: return has_gui.gui.ProgressBox(message, length) elif config.config.get("progress_bars"): return ProgressText(message, length) else: return ProgressNothing(message, length)
__getstate__ = ImageBase.__getstate__
def __del__(self): if self._display: self._display.close()
__getstate__ = ImageBase.__getstate__
def __init__(self, *args, **kwargs): ImageBase.__init__(self) gameracore.Cc.__init__(self, *args, **kwargs)
init_gamera()
def run(startup=_show_shell): global app has_gui.has_gui = has_gui.WX_GUI has_gui.gui = GameraGui from gamera.gui import args_gui init_gamera() class MyApp(wxApp): def __init__(self, startup, parent): self._startup = startup wxApp.__init__(self, parent) self.SetExitOnFrameDelete(1) # wxWindows calls this method to in...
self.trigger_callback("click", self.rubber_y2, self.rubber_x2, event.ShiftDown(), event.ControlDown())
self.trigger_callback("click", self.rubber_y2 + self.original_image.ul_y, self.rubber_x2 + self.original_image.ul_x, event.ShiftDown(), event.ControlDown())
def _OnLeftUp(self, event): if self.rubber_on: if self.HasCapture(): self.ReleaseMouse() self.draw_rubber() origin = [x * self.scroll_amount for x in self.GetViewStart()] self.rubber_x2 = int(max(min((event.GetX() + origin[0]) / self.scaling, self.image.ncols - 1), 0)) self.rubber_y2 = int(max(min((event.GetY() + origi...
self.trigger_callback("rubber", self.rubber_origin_y, self.rubber_origin_x, self.rubber_y2, self.rubber_x2, event.ShiftDown(), event.ControlDown())
self.trigger_callback("rubber", self.rubber_origin_y + self.original_image.ul_y, self.rubber_origin_x + self.original_image.ul_x, self.rubber_y2 + self.original_image.ul_y, self.rubber_x2 + self.original_image.ul_x, event.ShiftDown(), event.ControlDown())
def _OnLeftUp(self, event): if self.rubber_on: if self.HasCapture(): self.ReleaseMouse() self.draw_rubber() origin = [x * self.scroll_amount for x in self.GetViewStart()] self.rubber_x2 = int(max(min((event.GetX() + origin[0]) / self.scaling, self.image.ncols - 1), 0)) self.rubber_y2 = int(max(min((event.GetY() + origi...
self.trigger_callback("move", y2, x2)
self.trigger_callback("move", y2 + self.original_image.ul_y, x2 + self.original_image.ul_x)
def _OnMotion(self, event): image = self.image if image is None: return scaling = self.scaling origin = [x * self.scroll_amount for x in self.GetViewStart()] x2 = int(max(min((event.GetX() + origin[0]) / scaling, image.ncols - 1), 0)) y2 = int(max(min((event.GetY() + origin[1]) / scaling, image.nrows - 1), 0)) if self....
"(%d, %d): %s" % (x + image.ul_x, y + image.ul_y, self._iw.id.original_image.get(y, x)), 0)
"(%d, %d): %s" % (x, y, image.get(y - image.ul_y, x - image.ul_x)), 0)
def _OnMove(self, y, x): image = self._iw.id.original_image self._status_bar.SetStatusText( "(%d, %d): %s" % (x + image.ul_x, y + image.ul_y, self._iw.id.original_image.get(y, x)), 0)
"(%d, %d): %s" % (x1 + image.ul_x, y1 + image.ul_y, self._iw.id.original_image.get(y2, x2)), 1)
"(%d, %d): %s" % (x1, y1, image.get(y2 - image.ul_y, x2 - image.ul_x)), 1)
def _OnRubber(self, y1, x1, y2, x2, shift, ctrl): image = self._iw.id.original_image if y1 == y2 and x1 == x2: self._status_bar.SetStatusText( "(%d, %d): %s" % (x1 + image.ul_x, y1 + image.ul_y, self._iw.id.original_image.get(y2, x2)), 1) else: self._status_bar.SetStatusText( "(%d, %d) to (%d, %d) / (%d w, %d h) %s" % ...
(x1 + image.ul_x, y1 + image.ul_y, x2 + image.ul_x, y2 + image.ul_y, abs(x1-x2), abs(y1-y2), self._iw.id.original_image.get(y2, x2)), 1)
(x1, y1, x2, y2, abs(x1-x2), abs(y1-y2), image.get(y2 - image.ul_y, x2 - image.ul_x)), 1)
def _OnRubber(self, y1, x1, y2, x2, shift, ctrl): image = self._iw.id.original_image if y1 == y2 and x1 == x2: self._status_bar.SetStatusText( "(%d, %d): %s" % (x1 + image.ul_x, y1 + image.ul_y, self._iw.id.original_image.get(y2, x2)), 1) else: self._status_bar.SetStatusText( "(%d, %d) to (%d, %d) / (%d w, %d h) %s" % ...
for id in glyph.id_name: self._symbol_table.add(id[1])
for idx in glyph.id_name: self._symbol_table.add(idx[1])
def __init__(self, classifier, symbol_table=[], parent = None, id = -1, title = "Classifier", owner=None): if not isinstance(classifier, InteractiveClassifier): raise ValueError( "classifier must be instance of type InteractiveClassifier.") self._classifier = classifier
env = Environment()
inheritenv = (ARGUMENTS.get('inheritenv', 'n') in 'yY1') if inheritenv: env = Environment(ENV=os.environ) else: env = Environment()
def generate_dependencies(self): env = Environment() self.gen_mod_config(env) cc = env['CC'] cxx = env.subst(env['CXX']) common_flags = ARGUMENTS.get('cflags', '').split(' ') cxxflags = ARGUMENTS.get('cxxflags', '').split(' ') ldflags = ARGUMENTS.get('ldflags', '').split(' ') if cc == 'cl' and cxx == 'cl': env = Enviro...
create_dir_command = "rm -rf " + lcov_report_dir + " && mkdir " + lcov_report_dir + ";"
create_dir_command = "rm -rf " + lcov_report_dir create_dir_command += " && mkdir " + lcov_report_dir + ";"
def generate_dependencies (self): env = Environment() self.gen_mod_config (env) cc = env['CC'] cxx = env.subst (env['CXX']) common_flags = ARGUMENTS.get('cflags', '').split (' ') cxxflags = ARGUMENTS.get('cxxflags', '').split (' ') ldflags = ARGUMENTS.get('ldflags', '').split (' ') if cc == 'cl' and cxx == 'cl': env = ...
lcov_command = "utils/lcov/lcov -c -d . -o " info_file
lcov_command = "utils/lcov/lcov -c -d . -o " + info_file lcov_command += " --source-dirs=" + os.getcwd () lcov_command += ":" + os.path.join (os.getcwd (), variant.build_root, 'include')
def generate_dependencies (self): env = Environment() self.gen_mod_config (env) cc = env['CC'] cxx = env.subst (env['CXX']) common_flags = ARGUMENTS.get('cflags', '').split (' ') cxxflags = ARGUMENTS.get('cxxflags', '').split (' ') ldflags = ARGUMENTS.get('ldflags', '').split (' ') if cc == 'cl' and cxx == 'cl': env = ...
genhtml_command = "utils/lcov/genhtml -o " + lcov_report_data + " " + info_file
genhtml_command = "utils/lcov/genhtml -o " + lcov_report_dir genhtml_command += " " + info_file
def generate_dependencies (self): env = Environment() self.gen_mod_config (env) cc = env['CC'] cxx = env.subst (env['CXX']) common_flags = ARGUMENTS.get('cflags', '').split (' ') cxxflags = ARGUMENTS.get('cxxflags', '').split (' ') ldflags = ARGUMENTS.get('ldflags', '').split (' ') if cc == 'cl' and cxx == 'cl': env = ...
if env['PLATFORM'] == 'posix': module_builder = env.Program(target=filename, source=objects, LIBPATH=lib_path, LIBS=libs, RPATH=lib_path) else: module_builder = env.Program(target=filename, source=objects, LIBPATH=lib_path, LIBS=libs)
module_builder = env.Program(target=filename, source=objects, LIBPATH=lib_path, LIBS=libs)
def gen_mod_dep(self, variant): build_root = variant.build_root cpp_path = os.path.join(variant.build_root, 'include') env = variant.env env.Append(CPPPATH = [cpp_path]) header_dir = os.path.join(build_root, 'include', 'ns3') lib_path = os.path.join(build_root, 'lib') module_builders = [] for module in self.__modules: ...
TraversalError: '++fiz++bar'
TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++fiz++bar')
... def traverse(self, name, remaining):
TraversalError: '++foo++bar'
TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++foo++bar')
... def traverse(self, name, remaining):
raise TraversalError("++%s++%s" % (ns, name))
raise TraversalError(object, "++%s++%s" % (ns, name))
... def traverse(self, name, remaining):
... raise TraversalError(name)
... raise TraversalError(self, name)
... def traverse(self, name, remaining):
return new_getquicklinks(session)
return new_getquicklinks(self.session)
def getquicklinks(self): return new_getquicklinks(session)
self.uploadfile(session, dirname, pofilename), outputfile.getvalue())
self.uploadfile(session, dirname, pofilename, outputfile.getvalue())
def converttemplates(self, session): """creates PO files from the templates""" projectdir = os.path.join(self.potree.podirectory, self.projectcode) if not os.path.exists(projectdir): os.mkdir(projectdir) templatesdir = os.path.join(projectdir, "templates") if not os.path.exists(templatesdir): templatesdir = os.path.joi...
self.uploadfile(session, dirname, pofilename, outputfile.getvalue())
self.uploadfile(session, dirname, os.path.basename(pofilename), outputfile.getvalue())
def converttemplates(self, session): """creates PO files from the templates""" projectdir = os.path.join(self.potree.podirectory, self.projectcode) if not os.path.exists(projectdir): os.mkdir(projectdir) templatesdir = os.path.join(projectdir, "templates") if not os.path.exists(templatesdir): templatesdir = os.path.joi...
class pootlefile(base.TranslationStore, Wrapper):
class pootlefile(Wrapper):
def finditems(self, search): """returns items that match the .assignedto and/or .assignedaction criteria in the searchobject""" # search.assignedto == [None] means assigned to nobody if search.assignedto == [None]: assignitems = self.getunassigned(search.assignedaction) else: # filter based on assign criteria assigns =...
self.__innerobj__ = innerclass() self.UnitClass = innerclass.UnitClass
innerobj = innerclass() self.__innerobj__ = innerobj self.UnitClass = innerobj.UnitClass
def __init__(self, project=None, pofilename=None, generatestats=True): if pofilename: innerclass = factory.getclass(pofilename) self.__innerobj__ = innerclass() self.UnitClass = innerclass.UnitClass self.pofilename = pofilename if project is None: from Pootle import projects self.project = projects.DummyProject(None) ...
return os.path.join(self.podir, dirname, pofilename)
return os.path.join(self.podir, dirname, localfilename)
def getuploadpath(self, dirname, localfilename): """gets the path of a translation file being uploaded securely, creating directories as neccessary""" if os.path.isabs(dirname) or dirname.startswith("."): raise ValueError("invalid/insecure file path: %s" % dirname) if os.path.basename(localfilename) != localfilename or...
score = float(candidate.getnotes())
def buildmatches(inputfile, outputfile, matcher): """Builds a .po.tm file for use in Pootle""" #Can't use the same name: it might open the existing file! outputfile = factory.getobject(outputfile, ignore=".tm") #TODO: Do something useful with current content if file exists inputfile.units.sort(match.sourcelencmp) try:...
newunit.addnote("%d%%" % score)
newunit.addnote(candidate.getnotes())
def buildmatches(inputfile, outputfile, matcher): """Builds a .po.tm file for use in Pootle""" #Can't use the same name: it might open the existing file! outputfile = factory.getobject(outputfile, ignore=".tm") #TODO: Do something useful with current content if file exists inputfile.units.sort(match.sourcelencmp) try:...
self.innerclass = factory.getclass(pofilename) innerobj = self.innerclass()
innerclass = factory.getclass(pofilename) innerobj = innerclass()
def __init__(self, project=None, pofilename=None, generatestats=True): if pofilename: self.innerclass = factory.getclass(pofilename) innerobj = self.innerclass() self.__innerobj__ = innerobj self.UnitClass = innerobj.UnitClass self.pofilename = pofilename if project is None: from Pootle import projects self.project = ...
self.add_playable(Playable(self._uri)) self.next()
self.play_uri(self._uri)
def __init__(self, uri=''): self._uri = uri self._queue = [] self._current_item_index = -1 self._saved_item_index = None self._saved_status = None self._g_timeout_id = None self._playbin = gst.element_factory_make('playbin', 'playbin')
return self._queue[self._current_item_index]
try: return self._queue[self._current_item_index] except IndexError: import pdb; pdb.set_trace()
def get_current_item(self): """ Return the item of the playing queue which is currently selected """ return self._queue[self._current_item_index]
property.__init__(self, fget=self.get_extensions)
property.__init__(self)
def __init__(self, interface): property.__init__(self, fget=self.get_extensions) self.interface = interface
def get_extensions(self, master_plugin):
def __get__(self, master_plugin, typ):
def get_extensions(self, master_plugin): extensions = self._get_cached_extensions() for extension in extensions: extension.set_master_plugin(master_plugin) return extensions
_dir = os.path.dirname(zPictureBox.__file__) self._font = font.Font(_dir + '/font.ttf',72)
_dir = os.path.dirname(extern.testGL.__file__) _font_path = os.path.join(_dir, 'common', 'font.ttf') self._font = font.Font(_font_path,72)
def __init__(self, in_text = "font"): zPictureBox.PictureBox.__init__(self) font.init() if not font.get_init(): print 'Could not render font.' sys.exit(0) _dir = os.path.dirname(zPictureBox.__file__) self._font = font.Font(_dir + '/font.ttf',72) self._texture = None self._fontsize = 32 self.SetText(in_text)
<<<<<<< HEAD
def create_printer(): global _printer, config _printer = beaglebone_helpers.create_printer() _printer.prepared_file = None config = json_config_file.read() _printer.connect() _printer.configure(config)
======= port=80, >>>>>>> f42be67744150446bdce4fb0a646ab15a8e7c40a
def create_printer(): global _printer, config _printer = beaglebone_helpers.create_printer() _printer.prepared_file = None config = json_config_file.read() _printer.connect() _printer.configure(config)
not enough, words with less are choosen.
not enough, words with less are chosen.
def GetRandomList(self, listlength): """ GetRandomList(self, listlength) Returns a list of randomwords with listlength length. First choose words with most Levelchars, if these are not enough, words with less are choosen. """ retlist = [] selectlist = [] length = 0 val = 0 temp = 0 keys = self.list.keys() keys.sort() k...
print '\nConfiguration for %(Levelnum)s levels read. \n!!! Be aware, if the Levels are not numberd correctly \n!!! they will not be read completly!' %vars()
print '\nConfiguration for %(Levelnum)s levels read. \n!!! Be aware, if the Levels are not numberd correctly \n!!! they will not be read completely!' %vars()
def main(argv): Wordlist = [] UpcaseWordlist = [] # Reading the Wordlist try: wordfile = open(argv[1], 'r') except IOError: print "\nWordfile couldn't be opened.\n", DOCSTRING return 1 # Create two Wordlists, one with first char lowered # (more words for the first levels) and one like it ist read for wordstring in word...
pid = wx.wxExecute(cmd, 0, process)
if wx.wxVERSION > (2, 3, 2): flags = wx.wxEXEC_NOHIDE else: flags = 0 pid = wx.wxExecute(cmd, flags, process)
def spawnChild(monitor, process, args=''): """Returns an xmlrpclib.Server, a connection to an xml-rpc server, and the input and error streams. """ # Start ChildProcessServerStart.py in a new process. script_fn = os.path.join(os.path.dirname(__file__), 'ChildProcessServerStart.py') os.environ['PYTHONPATH'] = string.join...
params = None
params = []
def OnSetRunParams(self, event): model = self.getModel() dlg = wxTextEntryDialog(self.editor, 'Parameters:', 'Command-line parameters', model.lastRunParams) try: if dlg.ShowModal() == wxID_OK: model.lastRunParams = dlg.GetValue() # update running debuggers debugging this module debugger = self.editor.debugger if debugg...
create(self.editor).ShowModal()
rmtDlg = create(self.editor) rmtDlg.ShowModal() rmtDlg.Destroy()
def OnAttachToDebugger(self, event): # Attach dialog code here from Debugger.RemoteDialog import create create(self.editor).ShowModal()
self.SetText(self.model.data)
self.SetText(self.getModelData())
def refreshCtrl(self): self.pos = self.GetCurrentPos()
self.model.data = self.GetText()
self.setModelData(self.GetText())
def refreshModel(self): if self.isModified(): self.model.modified = true self.nonUserModification = false # hack to stop wxSTC from eating the last character self.InsertText(self.GetTextLength(), ' ') self.model.data = self.GetText() self.EmptyUndoBuffer() EditorViews.EditorView.refreshModel(self) # Remove from modi...
t1 = time.time() for i in range(1): self.refreshModel() t2 = time.time()
self.refreshModel()
def OnRefresh(self, event): t1 = time.time() for i in range(1): self.refreshModel() t2 = time.time()
self.breaks = {}
self.tryLoadBreakpoints()
def __init__(self, parent, model): if hasattr(model, 'app') and model.app: a2 = (('Run application', self.OnRunApp, self.runAppBmp, keyDefs['RunApp']),) else: a2 = () a1 = (('-', None, '', ()), ('Comment', self.OnComment, '-', keyDefs['Comment']), ('Uncomment', self.OnUnComment, '-', keyDefs['Uncomment']), ('Indent', s...
self.CallTipSetBackground(wxColour(255, 255, 232))
def __init__(self, parent, model): if hasattr(model, 'app') and model.app: a2 = (('Run application', self.OnRunApp, self.runAppBmp, keyDefs['RunApp']),) else: a2 = () a1 = (('-', None, '', ()), ('Comment', self.OnComment, '-', keyDefs['Comment']), ('Uncomment', self.OnUnComment, '-', keyDefs['Uncomment']), ('Indent', s...
self.SetMarginWidth(1, 13)
self.SetMarginWidth(1, 12)
def __init__(self, parent, model): if hasattr(model, 'app') and model.app: a2 = (('Run application', self.OnRunApp, self.runAppBmp, keyDefs['RunApp']),) else: a2 = () a1 = (('-', None, '', ()), ('Comment', self.OnComment, '-', keyDefs['Comment']), ('Uncomment', self.OnUnComment, '-', keyDefs['Uncomment']), ('Indent', s...
partial = line[dot+1:piv-1]
partial = line[dot+1:piv]
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
if sel: print 'auto selecting', partial, sel
else: self.AutoCompShow(len(partial), string.join(list, ' ')) self.AutoCompSelect(partial)
def checkCodeComp(self): pos = self.GetCurrentPos() lnNo = self.GetCurrentLine() lnStPs = self.GetLineStartPos(lnNo) line = self.GetCurrentLineText()[0] piv = pos - lnStPs start, length = idWord(line, piv, lnStPs) startLine = start-lnStPs word = line[startLine:startLine+length]
print 'adding break point', bp
self.MarkerAdd(bp.line -1, brkPtMrk) def setBdbBreakpoints(self): for bp in self.breaks.values():
def setInitialBreakpoints(self): for bp in self.breaks.values(): print 'adding break point', bp self.MarkerAdd(bp.line -1, brkPtMrk)
def tryLoadBreakpoints(self): import pickle fn = self.getBreakpointFilename() if os.path.exists(fn): self.breaks = pickle.load(open(fn)) self.setInitialBreakpoints() BrkPt = bdb.Breakpoint for lineNo, brk in self.breaks.items(): BrkPt.bpbynumber.append(brk) if BrkPt.bplist.has_key((brk.file, brk.line)): BrkPt.bplist[br...
def addBreakPoint(self, lineNo, temp = 0): if temp: mrk = tmpBrkPtMrk else: mrk = brkPtMrk hnd = self.MarkerAdd(lineNo - 1, mrk) filename = string.lower(self.model.filename)
self.SetCurrentPosition(pos + indentLevel)
if old_stc: self.SetCurrentPosition(pos + indentLevel) else: self.SetSelectionStart(pos + indentLevel)
def OnKeyDown(self, event):
def OnViewWhitespace(self, event): miid = self.menu.FindItem('View whitespace') if self.menu.IsChecked(miid): mode = wxSTC_WS_INVISIBLE self.menu.Check(miid, false) else: mode = wxSTC_WS_VISIBLEALWAYS self.menu.Check(miid, true) self.SetViewWhiteSpace(mode) def OnViewEOL(self, event): miid = self.menu.FindItem('View...
def OnAddCommentLine(self, event): pos = self.GetCurrentPos() ln = self.GetLineFromPos(pos) ls = self.GetLineStartPos(ln) self.InsertText(ls, '#-------------------------------------------' '------------------------------------'+'\n') self.SetCurrentPosition(ls+4)
HTMLStyledTextCtrlMix.OnUpdateUI(self, event)
if Preferences.braceHighLight: HTMLStyledTextCtrlMix.OnUpdateUI(self, event) class CPPSourceView(EditorStyledTextCtrl, CPPStyledTextCtrlMix): viewName = 'Source' def __init__(self, parent, model): EditorStyledTextCtrl.__init__(self, parent, wxID_CPPSOURCEVIEW, model, (('Refresh', self.OnRefresh, '-', keyDefs['Refresh'...
def OnUpdateUI(self, event): # don't update if not fully initialised if hasattr(self, 'pageIdx'): self.updateViewState() HTMLStyledTextCtrlMix.OnUpdateUI(self, event)
filename, lineno = self.adjustedFrameInfo(frame)[:-2]
filename, lineno = self.adjustedFrameInfo(frame)[-2:]
def break_here(self, frame): # Redefine breaking :( filename = frame.f_code.co_filename if filename == 'Script (Python)': # XXX filename, lineno = self.adjustedFrameInfo(frame)[:-2] else: filename = self.canonic(filename) lineno = frame.f_lineno if not self.breaks.has_key(filename): return 0 if not lineno in self.bre...
self.editor.openOrGotoModule(filename) model = self.editor.getActiveModulePage().model sourceView = model.views['Source'] sourceView.focus(false) sourceView.selectLine(lineno - 1) sourceView.setStepPos(lineno - 1) self.lastStepView = sourceView self.lastStepLineno = lineno - 1
try: self.editor.openOrGotoModule(filename) except Exception, err: print 'Counld not open: %s'%filename else: model = self.editor.getActiveModulePage().model sourceView = model.views['Source'] sourceView.focus(false) sourceView.selectLine(lineno - 1) sourceView.setStepPos(lineno - 1) self.lastStepView = sourceView sel...
def selectSourceLine(self, filename, lineno): if self.isSourceTracing(): self.clearStepPos() if not filename: return
self.toolbar.ToggleTool(wid, 1)
self.toolbar.EnableTool(wid, 1)
def enableStepping(self): # TODO: enable the step buttons. self.stepping_enabled = 1 for wid in (self.stepId, self.overId, self.outId): self.toolbar.ToggleTool(wid, 1)
self.toolbar.ToggleTool(wid, 0)
self.toolbar.EnableTool(wid, 0)
def disableStepping(self): # TODO: disable the step buttons. self.stepping_enabled = 0 for wid in (self.stepId, self.overId, self.outId): self.toolbar.ToggleTool(wid, 0)
wxVersion = tuple(map(lambda v: int(v), (string.split(wxPython.__version__, '.')+['0'])[:4]))
wxVersion = wxPython.__version__ for c in wxVersion: if c not in string.digits+'.': wxVersion = string.replace(wxVersion, c, '') wxVersion = tuple(map(lambda v: int(v), (string.split(wxVersion, '.')+['0'])[:4]))
def processArgs(argv): _doDebug = _doRemoteDebugSvr = _constricted = _emptyEditor = 0 _startupfile = '' _startupModules = () import getopt optlist, args = getopt.getopt(argv, 'CDTSBO:ERhv', ['Constricted', 'Debug', 'Trace', 'StartupFile', 'BlockHomePrefs', 'OverridePrefsDirName', 'EmptyEditor', 'RemoteDebugServer', 'he...
def __init__(self, parent, senders, inspector, designer):
def __init__(self, parent, senders, inspector, designer, colour, pnlStyle):
def __init__(self, parent, senders, inspector, designer):
self.dragCtrl = None
self.dragging = false
def __init__(self, parent, senders, inspector, designer):
self.dragSize = wxSize() self.lastDragPos = wxPoint()
self.colour = colour self.name = ''
def __init__(self, parent, senders, inspector, designer):
self.stTL = TLSelTag(parent, wxCURSOR_SIZENWSE, tagSize, self) self.stTR = TRSelTag(parent, wxCURSOR_SIZENESW, tagSize, self) self.stBR = BRSelTag(parent, wxCURSOR_SIZENWSE, tagSize, self) self.stBL = BLSelTag(parent, wxCURSOR_SIZENESW, tagSize, self) self.stT = TSelTag(parent, wxCURSOR_SIZENS, tagSize, self) self.stB ...
self.stTL = TLSelTag(parent, wxCURSOR_SIZENWSE, tagSize, self, pnlStyle) self.stTR = TRSelTag(parent, wxCURSOR_SIZENESW, tagSize, self, pnlStyle) self.stBR = BRSelTag(parent, wxCURSOR_SIZENWSE, tagSize, self, pnlStyle) self.stBL = BLSelTag(parent, wxCURSOR_SIZENESW, tagSize, self, pnlStyle) self.stT = TSelTag(parent, w...
def __init__(self, parent, senders, inspector, designer):
if self.dragCtrl:
if self.dragging:
def moveRelease(self): if self.dragTag: # XXX nasty passing a None event self.OnSizeEnd(None) self.showTags() if self.dragCtrl: # XXX Have to hide and show to clean up artifacts, refreshing # XXX is not sufficient. Show/hiding seems to screw up Z order self.dragCtrl.Show(false)
self.dragCtrl.Show(false) self.dragCtrl.SetDimensions( \
self.selection.Show(false) self.hideTags() self.selection.SetDimensions( \
def moveRelease(self): if self.dragTag: # XXX nasty passing a None event self.OnSizeEnd(None) self.showTags() if self.dragCtrl: # XXX Have to hide and show to clean up artifacts, refreshing # XXX is not sufficient. Show/hiding seems to screw up Z order self.dragCtrl.Show(false)
self.dragCtrl.Show(true) self.dragCtrl = None
self.selection.Show(true) self.dragging = false self.setSelection()
def moveRelease(self): if self.dragTag: # XXX nasty passing a None event self.OnSizeEnd(None) self.showTags() if self.dragCtrl: # XXX Have to hide and show to clean up artifacts, refreshing # XXX is not sufficient. Show/hiding seems to screw up Z order self.dragCtrl.Show(false)
self.lastDragPos.x = pos.x self.lastDragPos.y = pos.y
def moveCapture(self, ctrl, compn, pos): # Put selection around control
self.dragCtrl = ctrl self.dragOffset = pos self.showFramedTags(None) self.dragSize = ctrl.GetSize()
self.dragging = true self.dragOffset = pos self.showFramedTags(None)
def moveCapture(self, ctrl, compn, pos): # Put selection around control
def moving(self, ctrl, pos):
def moving(self, ctrl, pos, multiDragCtrl = None): if multiDragCtrl: dragCtrlPos = multiDragCtrl.GetPosition() movingCtrlPos = self.selection.GetPosition() pos = wxPoint(pos.x - dragCtrlPos.x + movingCtrlPos.x, pos.y - dragCtrlPos.y + movingCtrlPos.y) screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.Scree...
def moving(self, ctrl, pos): # Sizing if self.dragTag: screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos) if ctrl == self.designer: tb = self.designer.GetToolBar() if tb: parentPos.y = parentPos.y - tb.GetSize().y self.dragTag.setPos(parentPos) # Moving elif self.dragCtrl: self.lastD...
screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
def moving(self, ctrl, pos): # Sizing if self.dragTag: screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos) if ctrl == self.designer: tb = self.designer.GetToolBar() if tb: parentPos.y = parentPos.y - tb.GetSize().y self.dragTag.setPos(parentPos) # Moving elif self.dragCtrl: self.lastD...
elif self.dragCtrl: self.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
elif self.dragging:
def moving(self, ctrl, pos): # Sizing if self.dragTag: screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos) if ctrl == self.designer: tb = self.designer.GetToolBar() if tb: parentPos.y = parentPos.y - tb.GetSize().y self.dragTag.setPos(parentPos) # Moving elif self.dragCtrl: self.lastD...
dcs = self.parent.ClientToScreen(self.dragCtrl.GetPosition()) dccs = self.dragCtrl.ClientToScreen((0, 0))
dcs = self.parent.ClientToScreen(self.selection.GetPosition()) dccs = self.selection.ClientToScreen((0, 0))
def moving(self, ctrl, pos): # Sizing if self.dragTag: screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos) if ctrl == self.designer: tb = self.designer.GetToolBar() if tb: parentPos.y = parentPos.y - tb.GetSize().y self.dragTag.setPos(parentPos) # Moving elif self.dragCtrl: self.lastD...
self.setSelection() def selectCtrl(self, ctrl, compn):
self.setSelection() def selectCtrl(self, ctrl, compn, selectInInspector = true):
def moving(self, ctrl, pos): # Sizing if self.dragTag: screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos) if ctrl == self.designer: tb = self.designer.GetToolBar() if tb: parentPos.y = parentPos.y - tb.GetSize().y self.dragTag.setPos(parentPos) # Moving elif self.dragCtrl: self.lastD...
self.lastDragPos = wxPoint(self.position.x, self.position.y)
self.selCompn = compn
def selectCtrl(self, ctrl, compn): self.hideTags() if not ctrl: self.selection = None self.inspSel = None else: # XXX fix! if ctrl == self.designer: self.parent = ctrl cp = wxPoint(0, 0) screenPos = ctrl.ClientToScreen(cp) parentPos = self.parent.ScreenToClient(screenPos) else: self.parent = ctrl.GetParent() cp = ct...
self.inspSel = ctrl self.inspector.selectObject(ctrl, compn)
def selectCtrl(self, ctrl, compn): self.hideTags() if not ctrl: self.selection = None self.inspSel = None else: # XXX fix! if ctrl == self.designer: self.parent = ctrl cp = wxPoint(0, 0) screenPos = ctrl.ClientToScreen(cp) parentPos = self.parent.ScreenToClient(screenPos) else: self.parent = ctrl.GetParent() cp = ct...