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 are incorrect.")
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 are incorrect.")
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.ncols, cc.nrows) break
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 = max(min(origin[1] * scale / scaling + 1, h - self.GetSize().y) - 2, 0) self.scaling = scale self.SetScrollbars(scroll_amount, scroll_amount, floor(w / scroll_amount), floor(h / scroll_amount), floor(x / scroll_amount), floor(y / scroll_amount)) self.Clear() self.Refresh(0, rect=wxRect(0, 0, self.GetSize().x, self.GetSize().y))
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[1] if x > self.width or y > self.height: pass else: fudge = int(self.scaling / 2.0) w = (max(min(int((rects.GetW() / scaling) + fudge), self.width - ox), 0)) h = (max(min(int((rects.GetH() / scaling) + fudge), self.height - oy), 0)) self.PaintArea(x, y, w, h, check=0) rects.Next()
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.image.ul_x or y < self.image.ul_y): pass else: w = (max(min(int((rects.GetW()) + 1), self.width - ox), 0)) h = (max(min(int((rects.GetH()) + 1), self.height - oy), 0)) self.PaintArea(x, y, w, h, check=0) rects.Next() else: 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[1] if (x > self.image.lr_x or y > self.image.lr_y or x < self.image.ul_x or y < self.image.ul_y): pass else: fudge = int(self.scaling / 2.0) w = (max(min(int((rects.GetW() / scaling) + fudge), self.width - ox), 0)) h = (max(min(int((rects.GetH() / scaling) + fudge), self.height - oy), 0)) self.PaintArea(x, y, w, h, check=0) rects.Next()
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 faster while rects.HaveRects(): ox = rects.GetX() / scaling oy = rects.GetY() / scaling x = ox + origin_scaled[0] y = oy + origin_scaled[1] if x > self.width or y > self.height: pass else: # For some reason, the rectangles wxWindows gives are # a bit too small, so we need to fudge their size fudge = int(self.scaling / 2.0) w = (max(min(int((rects.GetW() / scaling) + fudge), self.width - ox), 0)) h = (max(min(int((rects.GetH() / scaling) + fudge), self.height - oy), 0)) self.PaintArea(x, y, w, h, check=0) rects.Next() self.draw_rubber()
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]) and (y + h < origin_scaled[1]) or (x > origin_scaled[0] + size_scaled[0] and y > origin_scaled[1] + size_scaled[1]) or (w == 0 or h == 0)): return if (y + h >= self.height): h = self.image.nrows - y - 2 if (x + w >= self.width): w = self.image.ncols - x - 2
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]) and (y + h < origin_scaled[1]) or (x > origin_scaled[0] + size_scaled[0] and y > origin_scaled[1] + size_scaled[1]) or (w == 0 or h == 0)): return if (y + h >= self.height): h = self.image.nrows - y - 2 if (x + w >= self.width): w = self.image.ncols - x - 2
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]) and (y + h < origin_scaled[1]) or (x > origin_scaled[0] + size_scaled[0] and y > origin_scaled[1] + size_scaled[1]) or (w == 0 or h == 0)): return if (y + h >= self.height): h = self.image.nrows - y - 2 if (x + w >= self.width): w = self.image.ncols - x - 2
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, "", extensions, self._flags) self.extensions = extensions
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, exc_traceback))))
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 importing file '%s':\n%s" % (file, "".join( traceback.format_exception(exc_type, exc_value, exc_traceback))))
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.SegmentationError: if len(glyph.id_name) >= 2: glyph.id_name = glyph.id_name[1:] else: glyph.id_name = [(0.0, '_ERROR')] return [] else: glyph.children_images = splits return splits return []
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.write("=" * progress) sys.stdout.write("-" * left) sys.stdout.write("|\r") sys.stdout.flush() if num >= den: self._done = 1 sys.stdout.write("\n") sys.stdout.flush()
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 initialize the application def OnInit(self): self.SetAppName("Gamera") self.splash = GameraSplash() self.splash.Show() self._startup() del self.splash return True def OnExit(self): pass app = MyApp(startup, 0) app.MainLoop()
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() + origin[1]) / self.scaling, self.image.nrows - 1), 0)) self.trigger_callback("click", self.rubber_y2, self.rubber_x2, event.ShiftDown(), event.ControlDown()) self.draw_rubber() if self.rubber_origin_x > self.rubber_x2: self.rubber_origin_x, self.rubber_x2 = \ self.rubber_x2, self.rubber_origin_x if self.rubber_origin_y > self.rubber_y2: self.rubber_origin_y, self.rubber_y2 = \ self.rubber_y2, self.rubber_origin_y self.rubber_on = 0 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.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() + origin[1]) / self.scaling, self.image.nrows - 1), 0)) self.trigger_callback("click", self.rubber_y2, self.rubber_x2, event.ShiftDown(), event.ControlDown()) self.draw_rubber() if self.rubber_origin_x > self.rubber_x2: self.rubber_origin_x, self.rubber_x2 = \ self.rubber_x2, self.rubber_origin_x if self.rubber_origin_y > self.rubber_y2: self.rubber_origin_y, self.rubber_y2 = \ self.rubber_y2, self.rubber_origin_y self.rubber_on = 0 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("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.rubber_on: self.draw_rubber() self.rubber_x2 = x2 self.rubber_y2 = y2 self.draw_rubber() if self.dragging: self.Scroll( (self.dragging_origin_x - (event.GetX() - self.dragging_x)) / self.scroll_amount, (self.dragging_origin_y - (event.GetY() - self.dragging_y)) / self.scroll_amount) self.trigger_callback("move", y2, x2)
"(%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 + 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" % (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)
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 = Environment(tools=['mingw']) cc = env['CC'] cxx = env.subst(env['CXX']) if cc == 'gcc' and cxx == 'g++': common_flags.extend(['-g3', '-Wall', '-Werror']) debug_flags = [] opti_flags = ['-O3'] elif cc == 'cl' and cxx == 'cl': env = Environment(ENV=os.environ) debug_flags = ['-W1', '-GX', '-EHsc', '-D_DEBUG', '/MDd'] opti_flags = ['-O2', '-EHsc', '-DNDEBUG', '/MD'] env.Append(CCFLAGS = common_flags, CPPDEFINES = ['RUN_SELF_TESTS'], TARFLAGS = '-c -z', CPPFLAGS = cxxflags, LINKFLAGS = ldflags) if env['PLATFORM'] == 'posix': env.Append(LINKFLAGS = ' -z origin') env.Append(RPATH=env.Literal(os.path.join('\\$$ORIGIN', os.pardir, 'lib'))) verbose = ARGUMENTS.get('verbose', 'n') if verbose == 'n': env['PRINT_CMD_LINE_FUNC'] = print_cmd_line header_builder = Builder(action = Action(MyCopyAction, strfunction=MyCopyActionPrint)) env.Append(BUILDERS = {'MyCopyBuilder':header_builder}) gcxx_builder = Builder(action = Action(MyCopyAction, strfunction=MyCopyActionPrint), emitter = GcxxEmitter) env.Append(BUILDERS = {'CopyGcxxBuilder':gcxx_builder}) variant = Ns3BuildVariant() builders = []
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 = Environment (tools = ['mingw']) cc = env['CC'] cxx = env.subst (env['CXX']) if cc == 'gcc' and cxx == 'g++': common_flags.extend (['-g3', '-Wall', '-Werror']) debug_flags = [] opti_flags = ['-O3'] elif cc == 'cl' and cxx == 'cl': env = Environment (ENV = os.environ) debug_flags = ['-W1', '-GX', '-EHsc', '-D_DEBUG', '/MDd'] opti_flags = ['-O2', '-EHsc', '-DNDEBUG', '/MD'] env.Append (CCFLAGS=common_flags, CPPDEFINES=['RUN_SELF_TESTS'], TARFLAGS='-c -z', CPPFLAGS=cxxflags, LINKFLAGS=ldflags) verbose = ARGUMENTS.get('verbose', 'n') if verbose == 'n': env['PRINT_CMD_LINE_FUNC'] = print_cmd_line header_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint)) env.Append (BUILDERS = {'MyCopyBuilder':header_builder}) gcxx_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint), emitter = GcxxEmitter) env.Append (BUILDERS = {'CopyGcxxBuilder':gcxx_builder}) variant = Ns3BuildVariant () builders = []
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 = Environment (tools = ['mingw']) cc = env['CC'] cxx = env.subst (env['CXX']) if cc == 'gcc' and cxx == 'g++': common_flags.extend (['-g3', '-Wall', '-Werror']) debug_flags = [] opti_flags = ['-O3'] elif cc == 'cl' and cxx == 'cl': env = Environment (ENV = os.environ) debug_flags = ['-W1', '-GX', '-EHsc', '-D_DEBUG', '/MDd'] opti_flags = ['-O2', '-EHsc', '-DNDEBUG', '/MD'] env.Append (CCFLAGS=common_flags, CPPDEFINES=['RUN_SELF_TESTS'], TARFLAGS='-c -z', CPPFLAGS=cxxflags, LINKFLAGS=ldflags) verbose = ARGUMENTS.get('verbose', 'n') if verbose == 'n': env['PRINT_CMD_LINE_FUNC'] = print_cmd_line header_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint)) env.Append (BUILDERS = {'MyCopyBuilder':header_builder}) gcxx_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint), emitter = GcxxEmitter) env.Append (BUILDERS = {'CopyGcxxBuilder':gcxx_builder}) variant = Ns3BuildVariant () builders = []
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 = Environment (tools = ['mingw']) cc = env['CC'] cxx = env.subst (env['CXX']) if cc == 'gcc' and cxx == 'g++': common_flags.extend (['-g3', '-Wall', '-Werror']) debug_flags = [] opti_flags = ['-O3'] elif cc == 'cl' and cxx == 'cl': env = Environment (ENV = os.environ) debug_flags = ['-W1', '-GX', '-EHsc', '-D_DEBUG', '/MDd'] opti_flags = ['-O2', '-EHsc', '-DNDEBUG', '/MD'] env.Append (CCFLAGS=common_flags, CPPDEFINES=['RUN_SELF_TESTS'], TARFLAGS='-c -z', CPPFLAGS=cxxflags, LINKFLAGS=ldflags) verbose = ARGUMENTS.get('verbose', 'n') if verbose == 'n': env['PRINT_CMD_LINE_FUNC'] = print_cmd_line header_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint)) env.Append (BUILDERS = {'MyCopyBuilder':header_builder}) gcxx_builder = Builder (action = Action (MyCopyAction, strfunction = MyCopyActionPrint), emitter = GcxxEmitter) env.Append (BUILDERS = {'CopyGcxxBuilder':gcxx_builder}) variant = Ns3BuildVariant () builders = []
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: objects = self.get_obj_builders(variant, module) libs = self.get_sorted_deps(module)
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.join(projectdir, "pot") if not os.path.exists(templatesdir): templatesdir = projectdir if self.potree.isgnustyle(self.projectcode): self.filestyle = "gnu" else: self.filestyle = "std" templates = self.potree.gettemplates(self.projectcode) if self.filestyle == "gnu": self.podir = projectdir if not templates: raise NotImplementedError("Cannot create GNU-style translation project without templates") else: self.podir = os.path.join(projectdir, self.languagecode) if not os.path.exists(self.podir): os.mkdir(self.podir) for potfilename in templates: inputfile = open(os.path.join(templatesdir, potfilename), "rb") outputfile = cStringIO.StringIO() if self.filestyle == "gnu": pofilename = self.languagecode + os.extsep + "po" else: pofilename = potfilename[:-len(os.extsep+"pot")] + os.extsep + "po" pofilename = os.path.basename(pofilename) origpofilename = os.path.join(self.podir, pofilename) if os.path.exists(origpofilename): origpofile = open(origpofilename) else: origpofile = None pot2po.convertpot(inputfile, outputfile, origpofile) dirname, potfilename = os.path.dirname(potfilename), os.path.basename(potfilename) self.uploadfile(session, dirname, pofilename), outputfile.getvalue())
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.join(projectdir, "pot") if not os.path.exists(templatesdir): templatesdir = projectdir if self.potree.isgnustyle(self.projectcode): self.filestyle = "gnu" else: self.filestyle = "std" templates = self.potree.gettemplates(self.projectcode) if self.filestyle == "gnu": self.podir = projectdir if not templates: raise NotImplementedError("Cannot create GNU-style translation project without templates") else: self.podir = os.path.join(projectdir, self.languagecode) if not os.path.exists(self.podir): os.mkdir(self.podir) for potfilename in templates: inputfile = open(os.path.join(templatesdir, potfilename), "rb") outputfile = cStringIO.StringIO() if self.filestyle == "gnu": pofilename = self.languagecode + os.extsep + "po" else: pofilename = potfilename[:-len(os.extsep+"pot")] + os.extsep + "po" origpofilename = os.path.join(self.podir, pofilename) if os.path.exists(origpofilename): origpofile = open(origpofilename) else: origpofile = None pot2po.convertpot(inputfile, outputfile, origpofile) dirname, potfilename = os.path.dirname(potfilename), os.path.basename(potfilename) self.uploadfile(session, dirname, pofilename, outputfile.getvalue())
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.getassigns() if search.assignedto: usernames = [search.assignedto] else: usernames = assigns.iterkeys() assignitems = [] for username in usernames: if search.assignedaction: actionitems = assigns[username].get(search.assignedaction, []) assignitems.extend(actionitems) else: for actionitems in assigns[username].itervalues(): assignitems.extend(actionitems) return assignitems
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) self.checker = None self.filename = self.pofilename else: self.project = project self.checker = self.project.checker self.filename = os.path.join(self.project.podir, self.pofilename) self.lockedfile = LockedFile(self.filename) # we delay parsing until it is required self.pomtime = None self.assigns = pootleassigns(self)
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 localfilename.startswith("."): raise ValueError("invalid/insecure file name: %s" % localfilename) if self.filestyle == "gnu": if not self.potree.languagematch(self.languagecode, localfilename[:-len("."+self.fileext)]): raise ValueError("invalid GNU-style file name %s: must match '%s.%s' or '%s[_-][A-Z]{2,3}.%s'" % (localfilename, self.fileext, self.languagecode, self.languagecode, self.fileext)) dircheck = self.podir for part in dirname.split(os.sep): dircheck = os.path.join(dircheck, part) if dircheck and not os.path.isdir(dircheck): os.mkdir(dircheck) return os.path.join(self.podir, dirname, pofilename)
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: for unit in inputfile.units: if len(unit.source) > 70: break if not unit.source: continue candidates = matcher.matches(unit.source) for candidate in candidates: score = float(candidate.getnotes()) source = candidate.source target = candidate.target newunit = outputfile.addsourceunit(source) newunit.target = target newunit.addnote("%d%%" % score) newunit.addlocations(unit.getlocations()) except exceptions.KeyboardInterrupt: # Let's write what we have so far return outputfile return outputfile
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: for unit in inputfile.units: if len(unit.source) > 70: break if not unit.source: continue candidates = matcher.matches(unit.source) for candidate in candidates: score = float(candidate.getnotes()) source = candidate.source target = candidate.target newunit = outputfile.addsourceunit(source) newunit.target = target newunit.addnote("%d%%" % score) newunit.addlocations(unit.getlocations()) except exceptions.KeyboardInterrupt: # Let's write what we have so far return outputfile return outputfile
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 = projects.DummyProject(None) self.checker = None self.filename = self.pofilename else: self.project = project self.checker = self.project.checker self.filename = os.path.join(self.project.podir, self.pofilename) self.lockedfile = LockedFile(self.filename) # we delay parsing until it is required self.pomtime = None self.assigns = pootleassigns(self)
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() keys.reverse() for key in keys: if length < listlength: for count in range(len(self.list[key]) - 1): if length < listlength and key > 0 : num = randint (0, len(self.list[key]) - 1) word = self.list[key][num] temp = temp + key del(self.list[key][num]) val = val + 1 length = length + len(word) selectlist.append(word) else: break else: break temp = float(temp) / val / 10 print 'Got words with an averages of %(temp).2f %% lchars.' %vars() # Select the returnlist from selectlist val = val - 1 length = 0 while length < listlength: word = selectlist[randint(0, val)] length = length + len(word) retlist.append(word)
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 wordfile.readlines(): wordstring = strip(wordstring) if lower(wordstring) != wordstring: UpcaseWordlist.append(wordstring) Wordlist.append(lower(wordstring)) wordfile.close() # Parse the configfile # Creates a List Levelops with [(Options), ] # Optiontuple contains (lchars, title, rows) conf = ConfigParser.ConfigParser() try: file = open(argv[2],'r') except IOError: print '\nConfigfile could not be opened.\n', DOCSTRING return 1 file.close() conf.read(argv[2]) try: Rowlength = conf.getint('Main', 'row_length') except ConfigParser.MissingSectionHeaderError: print '\nWrong configfile. See ktouchgen.py for Documentation.' + DOCSTRING Levelrows = conf.getint('Main', 'level_rows') Levelops = [] Levelnum = 1 section = 'Level' + str(Levelnum) while conf.has_section(section): lchars = [] try: for char in strip(conf.get(section, 'lchars')): lchars.append(char) except ConfigParser.NoOptionError: print '\nNo characters defined for level %(Levelnum)s !' %vars() return 1 try: title = conf.get(section, 'title') except ConfigParser.NoOptionError: title = join(lchars) try: rows = conf.getint(section, 'rows') except ConfigParser.NoOptionError: rows = Levelrows try: type = conf.getint(section, 'type') except ConfigParser.NoOptionError: type = 0 Levelops.append((lchars, title, rows, type)) Levelnum = Levelnum + 1 section = 'Level' + str(Levelnum) 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() # Generate Output try: outfile = open(argv[3], 'w') except IOError: print "Outputfile could not be opened.\n", DOCSTRING return 1 outfile.write('#########################################################\n' +\ '# Trainingfile generaded ' + time.ctime(time.time()) + '\n' +\ '# Program written by Hendrik Naumann <[email protected]>\n' +\ '# Inspired by Hvard Friland\'s version\n' +\ '#########################################################\n') permit_chars = [] Levelnum = 0 for Option in Levelops: cachestring = "" Levelnum = Levelnum + 1 for new_char in Option[0]: if new_char not in join(permit_chars,""): permit_chars.extend(Option[0]) outfile.write('\n# Level %(Levelnum)s\n' %vars() + Option[1] + "\n") print "Generating Level " + str(Levelnum) print join(permit_chars,"") # Generate a LevelList object and give the needed Wordlists levelwordlist = LevelList (Option[0], permit_chars) if Option[3] == 0: if lower(join(permit_chars,"")) != join(permit_chars,""): if upper(join(Option[0],"")) != join(Option[0],""): levelwordlist.SelectWords(Wordlist) levelwordlist.SelectWords(UpcaseWordlist) else: levelwordlist.SelectWords(Wordlist) randomlist = levelwordlist.GetRandomList(Rowlength * Option[2]) else: randomlist = levelwordlist.GetArtList(Rowlength * Option[2], Option[3]) # Write the randomlist for word in randomlist: cachestring = cachestring + " " + word if len(cachestring) > Rowlength - 3: outfile.write(strip(cachestring) + "\n") cachestring = "" outfile.close() return 0
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(sys.path, os.pathsep) cmd = '%s "%s" %s' % (sys.executable, script_fn, args) try: pid = wx.wxExecute(cmd, 0, process) line = '' if monitor.isAlive(): istream = process.GetInputStream() estream = process.GetErrorStream() err = '' # read in the port and auth hash while monitor.isAlive() and string.find(line, '\n') < 0: # don't take more time than the process we wait for ;) time.sleep(0.00001) if not istream.eof(): line = line + istream.read(1) # test for tracebacks on stderr if not estream.eof(): err = estream.read() errlines = string.split(err, '\n') while not string.strip(errlines[-1]): del errlines[-1] exctype, excvalue = string.split(errlines[-1], ':') while errlines and errlines[-1][:7] != ' File ': del errlines[-1] if errlines: errfile = ' (%s)' % string.strip(errlines[-1]) else: errfile = '' raise __builtins__[string.strip(exctype)], ( string.strip(excvalue)+errfile) if not KEEP_STREAMS_OPEN: process.CloseOutput() if monitor.isAlive(): line = string.strip(line) if not line: raise RuntimeError, ( 'The debug server address could not be read') port, auth = string.split(string.strip(line)) if USE_TCPWATCH: # Start TCPWatch as a connection forwarder. from thread import start_new_thread new_port = 20202 # Hopefully free def run_tcpwatch(port1, port2): os.system("tcpwatch -L %d:127.0.0.1:%d" % ( int(port1), int(port2))) start_new_thread(run_tcpwatch, (new_port, port)) time.sleep(3) port = new_port trans = TransportWithAuth(auth) server = xmlrpclib.Server( 'http://127.0.0.1:%d' % int(port), trans) return server, istream, estream, pid else: raise RuntimeError, 'The debug server failed to start' except: if monitor.isAlive(): process.CloseOutput() monitor.kill() raise
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 debugger and debugger.filename == model.localFilename(): if model.lastRunParams: params = methodparse.safesplitfields(model.lastRunParams, ' ') else: params = None self.editor.debugger.setParams(params) finally: dlg.Destroy()
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 modified views list if self.model.viewsModified.count(self.viewName): self.model.viewsModified.remove(self.viewName) self.updateEditor()
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', self.OnIndent, '-', keyDefs['Indent']), ('Dedent', self.OnDedent, '-', keyDefs['Dedent']), ('-', None, '-', ()), ('Profile', self.OnProfile, self.profileBmp, ()), ('Compile', self.OnCompile, self.compileBmp, keyDefs['Compile'])) a3 = (('Run module', self.OnRun, self.runBmp, keyDefs['RunMod']), ('Run module with parameters', self.OnRunParams, '-', ()), ('Debug', self.OnDebug, self.debugBmp, keyDefs['Debug']), ('-', None, '', ()), ('Run to cursor', self.OnRunToCursor, self.runCrsBmp, ()), ('Toggle breakpoint', self.OnSetBreakPoint, self.breakBmp, keyDefs['ToggleBrk']), ('-', None, '', ()), ('Add module info', self.OnAddModuleInfo, self.modInfoBmp, ()), ('Add comment line', self.OnAddCommentLine, '-', keyDefs['DashLine']), ('Add simple app', self.OnAddSimpleApp, '-', ()), ('-', None, '-', ()), ('Context help', self.OnContextHelp, '-', keyDefs['ContextHelp'])) wxID_PYTHONSOURCEVIEW = wxNewId() EditorStyledTextCtrl.__init__(self, parent, wxID_PYTHONSOURCEVIEW, model, a1 + a2 + a3, -1) PythonStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 0) BrowseStyledTextCtrlMix.__init__(self) FoldingStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 2) # Initialise breakpts from bdb.Breakpoint self.breaks = {} filename = string.lower(self.model.filename) for file, lineno in bdb.Breakpoint.bplist.keys(): if file == filename: for bp in bdb.Breakpoint.bplist[(file, lineno)]: self.breaks[lineno] = bp
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', self.OnIndent, '-', keyDefs['Indent']), ('Dedent', self.OnDedent, '-', keyDefs['Dedent']), ('-', None, '-', ()), ('Profile', self.OnProfile, self.profileBmp, ()), ('Compile', self.OnCompile, self.compileBmp, keyDefs['Compile'])) a3 = (('Run module', self.OnRun, self.runBmp, keyDefs['RunMod']), ('Run module with parameters', self.OnRunParams, '-', ()), ('Debug', self.OnDebug, self.debugBmp, keyDefs['Debug']), ('-', None, '', ()), ('Run to cursor', self.OnRunToCursor, self.runCrsBmp, ()), ('Toggle breakpoint', self.OnSetBreakPoint, self.breakBmp, keyDefs['ToggleBrk']), ('-', None, '', ()), ('Add module info', self.OnAddModuleInfo, self.modInfoBmp, ()), ('Add comment line', self.OnAddCommentLine, '-', keyDefs['DashLine']), ('Add simple app', self.OnAddSimpleApp, '-', ()), ('-', None, '-', ()), ('Context help', self.OnContextHelp, '-', keyDefs['ContextHelp'])) wxID_PYTHONSOURCEVIEW = wxNewId() EditorStyledTextCtrl.__init__(self, parent, wxID_PYTHONSOURCEVIEW, model, a1 + a2 + a3, -1) PythonStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 0) BrowseStyledTextCtrlMix.__init__(self) FoldingStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 2) # Initialise breakpts from bdb.Breakpoint self.breaks = {} filename = string.lower(self.model.filename) for file, lineno in bdb.Breakpoint.bplist.keys(): if file == filename: for bp in bdb.Breakpoint.bplist[(file, lineno)]: self.breaks[lineno] = bp
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', self.OnIndent, '-', keyDefs['Indent']), ('Dedent', self.OnDedent, '-', keyDefs['Dedent']), ('-', None, '-', ()), ('Profile', self.OnProfile, self.profileBmp, ()), ('Compile', self.OnCompile, self.compileBmp, keyDefs['Compile'])) a3 = (('Run module', self.OnRun, self.runBmp, keyDefs['RunMod']), ('Run module with parameters', self.OnRunParams, '-', ()), ('Debug', self.OnDebug, self.debugBmp, keyDefs['Debug']), ('-', None, '', ()), ('Run to cursor', self.OnRunToCursor, self.runCrsBmp, ()), ('Toggle breakpoint', self.OnSetBreakPoint, self.breakBmp, keyDefs['ToggleBrk']), ('-', None, '', ()), ('Add module info', self.OnAddModuleInfo, self.modInfoBmp, ()), ('Add comment line', self.OnAddCommentLine, '-', keyDefs['DashLine']), ('Add simple app', self.OnAddSimpleApp, '-', ()), ('-', None, '-', ()), ('Context help', self.OnContextHelp, '-', keyDefs['ContextHelp'])) wxID_PYTHONSOURCEVIEW = wxNewId() EditorStyledTextCtrl.__init__(self, parent, wxID_PYTHONSOURCEVIEW, model, a1 + a2 + a3, -1) PythonStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 0) BrowseStyledTextCtrlMix.__init__(self) FoldingStyledTextCtrlMix.__init__(self, wxID_PYTHONSOURCEVIEW, 2) # Initialise breakpts from bdb.Breakpoint self.breaks = {} filename = string.lower(self.model.filename) for file, lineno in bdb.Breakpoint.bplist.keys(): if file == filename: for bp in bdb.Breakpoint.bplist[(file, lineno)]: self.breaks[lineno] = bp
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[brk.file, brk.line].append(brk) else: BrkPt.bplist[brk.file, brk.line] = [brk] return true else: self.breaks = {} return false def saveBreakpoints(self): import pickle fn = self.getBreakpointFilename() if len(self.breaks): pickle.dump(self.breaks, open(fn, 'w')) elif os.path.exists(fn): os.remove(fn)
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 EOL characters') check = not self.menu.IsChecked(miid) self.menu.Check(miid, check) self.SetViewEOL(check) def underlineWord(self, start, length): start, length = BrowseStyledTextCtrlMix.underlineWord(self, start, length) if self.model.editor.debugger: word, line, lnNo, wordStart = self.getStyledWordElems(start, length) self.IndicatorSetColour(0, wxRED) try: val = self.model.editor.debugger.getVarValue(word) except Exception, message: val = str(message) if val: self.model.editor.statusBar.setHint(val) else: self.IndicatorSetColour(0, wxBLUE) return start, length def getBreakpointFilename(self): return os.path.splitext(self.model.filename)[0]+'.brk' def OnSaveBreakPoints(self, event): self.saveBreakpoints() def OnLoadBreakPoints(self, event): self.tryLoadBreakpoints()
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']),), -1) CPPStyledTextCtrlMix.__init__(self, wxID_CPPSOURCEVIEW) self.active = true def OnUpdateUI(self, event): if hasattr(self, 'pageIdx'): self.updateViewState() class HPPSourceView(CPPSourceView): viewName = 'Header' def __init__(self, parent, model): CPPSourceView.__init__(self, parent, model) def refreshCtrl(self): self.pos = self.GetCurrentPos() prevVsblLn = self.GetFirstVisibleLine() self.SetText(self.model.headerData) self.EmptyUndoBuffer() self.GotoPos(self.pos) curVsblLn = self.GetFirstVisibleLine() self.ScrollBy(0, prevVsblLn - curVsblLn) self.nonUserModification = false self.updatePageName()
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.breaks[filename]: return 0 # flag says ok to delete temp. bp (bp, flag) = bdb.effective(filename, lineno, frame) if bp: self.currentbp = bp.number if (flag and bp.temporary): self.do_clear(str(bp.number)) return 1 else: return 0
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 self.lastStepLineno = lineno - 1
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', 'help', 'version']) if (('-D', '') in optlist or ('--Debug', '') in optlist) and len(args): # XXX should be able to 'debug in running Boa' _doDebug = 1 elif (('-R', '') in optlist or ('--RemoteDebugServer', '') in optlist) and len(args): _doRemoteDebugSvr = 1 elif ('-T', '') in optlist or ('--Trace', '') in optlist: print 'Running in trace mode.' global tracefile tracefile = open('Boa.trace', 'wt') tracefile.write(os.getcwd()+'\n') trace_func(get_current_frame().f_back, 'call', None) trace_func(get_current_frame(), 'call', None) if trace_mode == 'functions': sys.setprofile(trace_func) elif trace_mode == 'lines': sys.settrace(trace_func) if len(args): # XXX Only the first file appears in the list when multiple files # XXX are drag/dropped on a Boa shortcut, why? _startupModules = args if ('-S', '') in optlist or ('--StartupFile', '') in optlist: _startupfile = startupEnv if ('-C', '') in optlist or ('--Constricted', '') in optlist: _constricted = 1 if ('-E', '') in optlist or ('--EmptyEditor', '') in optlist: _emptyEditor = 1 if ('-h', '') in optlist or ('--help', '') in optlist: print 'Version: %s'%__version__.version print 'Command-line usage: Boa.py [options] [file1] [file2] ...' print '-C, --Constricted:' print '\tRuns in constricted mode, overrides the Preference' print '-D, --Debug:' print '\tRuns the first filename passed on the command-line in the Debugger ' print '\ton startup' print '-T, --Trace:' print '\tRuns in traceing mode. Used for tracking down core dumps. Every ' print '\tfunction call is logged to a file which can later be parsed for ' print '\ta traceback' print '-S, --StartupFile:' print '\tExecutes the script pointed to by $BOASTARTUP or '\ '$PYTHONSTARTUP in' print '\tthe Shell namespace. The Editor object is available as sys.boa_ide.' print '\tOverrides the Preference' print '-B, --BlockHomePrefs:' print '\tPrevents the $HOME directory being used ' print '-O dirname, --OverridePrefsDirName dirname:' print '\tSpecify a different directory to load Preferences from.' print '\tDefault is .boa and is used if it exists' print '\tDirectory will be created (and populated) if it does not exist' print '-E, --EmptyEditor:' print "\tDon't open the files that were open last time Boa was closed." print '-R, --RemoteDebugServer:' print "\tRuns the first filename passed on the command-line in a " print "\tRemote Debugger Server that can be connected to over a socket.'" sys.exit() if ('-v', '') in optlist or ('--version', '') in optlist: print 'Version: %s'%__version__.version sys.exit() return (_doDebug, _startupfile, _startupModules, _constricted, _emptyEditor, _doRemoteDebugSvr, optlist, args)
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 = BSelTag(parent, wxCURSOR_SIZENS, tagSize, self) self.stL = LSelTag(parent, wxCURSOR_SIZEWE, tagSize, self) self.stR = RSelTag(parent, wxCURSOR_SIZEWE, tagSize, self)
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, wxCURSOR_SIZENS, tagSize, self, pnlStyle) self.stB = BSelTag(parent, wxCURSOR_SIZENS, tagSize, self, pnlStyle) self.stL = LSelTag(parent, wxCURSOR_SIZEWE, tagSize, self, pnlStyle) self.stR = RSelTag(parent, wxCURSOR_SIZEWE, tagSize, self, pnlStyle)
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.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.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
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.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
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.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
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.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
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.lastDragPos.x = pos.x self.lastDragPos.y = pos.y screenPos = ctrl.ClientToScreen(pos) parentPos = self.parent.ScreenToClient(screenPos)
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 = ctrl.GetPosition()
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 = ctrl.GetPosition()