rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
self.contents[name.replace('_', '-')] = value | self.contents[toVName(name)] = value | def __setattr__(self, name, value): """For convenience, make self.contents directly accessible. |
self.contents[name.replace('_', '-')] = [value] | self.contents[toVName(name)] = [value] | def __setattr__(self, name, value): """For convenience, make self.contents directly accessible. |
del self.contents[name[:-5].replace('_', '-')] | del self.contents[toVName(name, 5)] | def __delattr__(self, name): try: if name not in self.normal_attributes and name.lower()==name: if name.endswith('_list'): del self.contents[name[:-5].replace('_', '-')] else: del self.contents[name.replace('_', '-')] else: object.__delattr__(self, name) except KeyError: raise exceptions.AttributeError, name |
del self.contents[name.replace('_', '-')] | del self.contents[toVName(name)] | def __delattr__(self, name): try: if name not in self.normal_attributes and name.lower()==name: if name.endswith('_list'): del self.contents[name[:-5].replace('_', '-')] else: del self.contents[name.replace('_', '-')] else: object.__delattr__(self, name) except KeyError: raise exceptions.AttributeError, name |
child = self.contents.get(childName) | child = self.contents.get(toVName(childName)) | def getChildValue(self, childName, childNumber = 0): """Return a child's value (the first, by default), or None.""" child = self.contents.get(childName) if child is None: return None else: return child[childNumber].value |
glOrtho(-self.window_size, self.window_size, -h*self.window_size, h*self.window_size, znear, zfar) | glOrtho(-w*self.window_size, w*self.window_size, -h*self.window_size, h*self.window_size, znear, zfar) | def draw(self, selection_box=None): # gl_context sensitive method # This function is called when the color and depth buffers have to be # refreshed, or when the user points to an object and you want to # identify it. viewport = glGetIntegerv(GL_VIEWPORT) width = viewport[2] height = viewport[3] |
def read_from_attribute(self): | def convert_to_representation(self, value): | def read_from_attribute(self): if self.transpose: return tuple(self.attribute.transpose().ravel()) else: return tuple(self.attribute.ravel()) |
return tuple(self.attribute.transpose().ravel()) | intermediate = tuple(value.transpose().ravel()) | def read_from_attribute(self): if self.transpose: return tuple(self.attribute.transpose().ravel()) else: return tuple(self.attribute.ravel()) |
return tuple(self.attribute.ravel()) def write_to_attribute(self, value): | intermediate = tuple(value.ravel()) return Composed.convert_to_representation(self, intermediate) def convert_to_value(self, representation): intermediate = Composed.convert_to_value(self, representation) | def read_from_attribute(self): if self.transpose: return tuple(self.attribute.transpose().ravel()) else: return tuple(self.attribute.ravel()) |
self.attribute = numpy.array(value) | result = numpy.array(intermediate) | def write_to_attribute(self, value): if self.transpose: self.attribute = numpy.array(value) if len(self.shape) == 1: self.attribute.shape = self.shape else: self.attribute.shape = (self.shape[0], self.shape[1]) self.attribute = self.attribute.transpose() else: self.attribute = numpy.array(value) self.attribute.shape = ... |
self.attribute.shape = self.shape | result.shape = self.shape | def write_to_attribute(self, value): if self.transpose: self.attribute = numpy.array(value) if len(self.shape) == 1: self.attribute.shape = self.shape else: self.attribute.shape = (self.shape[0], self.shape[1]) self.attribute = self.attribute.transpose() else: self.attribute = numpy.array(value) self.attribute.shape = ... |
self.attribute.shape = (self.shape[0], self.shape[1]) self.attribute = self.attribute.transpose() | result.shape = (self.shape[0], self.shape[1]) result = result.transpose() | def write_to_attribute(self, value): if self.transpose: self.attribute = numpy.array(value) if len(self.shape) == 1: self.attribute.shape = self.shape else: self.attribute.shape = (self.shape[0], self.shape[1]) self.attribute = self.attribute.transpose() else: self.attribute = numpy.array(value) self.attribute.shape = ... |
self.attribute = numpy.array(value) self.attribute.shape = self.shape | result = numpy.array(intermediate) result.shape = self.shape return result | def write_to_attribute(self, value): if self.transpose: self.attribute = numpy.array(value) if len(self.shape) == 1: self.attribute.shape = self.shape else: self.attribute.shape = (self.shape[0], self.shape[1]) self.attribute = self.attribute.transpose() else: self.attribute = numpy.array(value) self.attribute.shape = ... |
def __init__(self, glade_file, widget, widget_dict_name=None): | def __init__(self, glade_file, widget_name, widget_dict_name=None): | def __init__(self, glade_file, widget, widget_dict_name=None): "This method loads the widget from the glade XML file" # widget_dict_name is the name of the attribute to which the widget # will be assigned. if left to none the widget name will be used |
self.widgets = gtk.glade.XML(os.path.join(directory, glade_file), widget) | self.widgets = gtk.glade.XML(os.path.join(directory, glade_file), widget_name) | def __init__(self, glade_file, widget, widget_dict_name=None): "This method loads the widget from the glade XML file" # widget_dict_name is the name of the attribute to which the widget # will be assigned. if left to none the widget name will be used |
widget_dict_name = widget widget = self.widgets.get_widget(widget) | widget_dict_name = widget_name widget = self.widgets.get_widget(widget_name) | def __init__(self, glade_file, widget, widget_dict_name=None): "This method loads the widget from the glade XML file" # widget_dict_name is the name of the attribute to which the widget # will be assigned. if left to none the widget name will be used |
raise GladeWrapperError, "The widget (" + widget + ") passed to the constructor does not exist." | raise GladeWrapperError, "The widget '%s' passed to the constructor does not exist." % widget_name | def __init__(self, glade_file, widget, widget_dict_name=None): "This method loads the widget from the glade XML file" # widget_dict_name is the name of the attribute to which the widget # will be assigned. if left to none the widget name will be used |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, message) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, full) | def ok_information(message, details="", line_wrap=True): full = apply_template(template, (message, details)) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, message) return run_dialog(dialog, line_wrap) |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, full) | def yes_no_question(message, details="", line_wrap=True): full = apply_template(template, (message, details)) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, message) return run_dialog(dialog, line_wrap) |
dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, message) | dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, full) | def nosave_cancel_save_question(message, details="", line_wrap=True): full = apply_template(template, (message, details)) dialog = gtk.MessageDialog(context.parent_window, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, message) dialog.add_button(gtk.STOCK_NO, gtk.RESPONSE_NO) dialog.add_button(gtk.STOCK_CANCEL, gtk.RESPONS... |
def create_references(self, targets): | def create_references(self): | def create_references(self, targets): raise NotImplementedError |
first = reference.parent.children[0] | first = reference.parent.children[0].target | def yield_neighbours(self): for reference in self.references: first = reference.parent.children[0] if first == self: yield reference.parent.children[1] else: yield first |
yield reference.parent.children[1] | yield reference.parent.children[1].target | def yield_neighbours(self): for reference in self.references: first = reference.parent.children[0] if first == self: yield reference.parent.children[1] else: yield first |
field.sensitive_button.destroy() field.sensitive_button = None | if field.get_active(): field.sensitive_button.destroy() field.sensitive_button = None | def destroy_widgets(self): if self.buttons != NO_BUTTONS: for field in self.fields: field.sensitive_button.destroy() field.sensitive_button = None |
field.sensitive_button.set_active(field.read_from_widget() != insensitive) | if field.get_active(): field.sensitive_button.set_active(field.read_from_widget() != insensitive) | def read(self, instance=None): Group.read(self, instance=None) if self.buttons != NO_BUTTONS: for field in self.fields: field.sensitive_button.set_active(field.read_from_widget() != insensitive) |
def cached_analyze_selection(Class, *arguments): | def cached_analyze_selection(Class, **arguments): | def cached_analyze_selection(Class, *arguments): if Class.last_analysis_result is None: Class.last_analysis_result = Class.analyze_selection(*arguments) # print Class, "NEW", Class.last_analysis_result #else: # print Class, "CACHED", Class.last_analysis_result return Class.last_analysis_result |
Class.last_analysis_result = Class.analyze_selection(*arguments) | Class.last_analysis_result = Class.analyze_selection(**arguments) | def cached_analyze_selection(Class, *arguments): if Class.last_analysis_result is None: Class.last_analysis_result = Class.analyze_selection(*arguments) # print Class, "NEW", Class.last_analysis_result #else: # print Class, "CACHED", Class.last_analysis_result return Class.last_analysis_result |
def analyze_selection(parameters): | def analyze_selection(parameters=None): | def analyze_selection(parameters): return Immediate.analyze_selection() |
"max_histroy_length", | "max_history_length", | def corrector_default_units(value): for measure, units in units_by_measure.iteritems(): if (measure not in value) or (value[measure] not in units): value[measure] = units[0] return dict( (measure, unit) for measure, unit in value.iteritems() if measure in measures ) |
attribute_name="max_histroy_length", | attribute_name="max_history_length", | def corrector_default_units(value): for measure, units in units_by_measure.iteritems(): if (measure not in value) or (value[measure] not in units): value[measure] = units[0] return dict( (measure, unit) for measure, unit in value.iteritems() if measure in measures ) |
origin = -0.5*sum(self.cell.transpose()) | origin = -0.5*sum((self.cell*self.cell_active).transpose()) | def draw_gray(origin, axis1, axis2, n1, n2, delta, nd): set_color(gray, gray, gray) if n1 == 0 and n2 == 0: return for i1 in xrange(n1+1): if i1 == 0: b2 = 1 draw_line(origin+delta, origin+nd*delta) else: b2 = 0 for i2 in xrange(b2, n2+1): draw_line(origin+i1*axis1+i2*axis2, origin+i1*axis1+i2*axis2+nd*delta) |
draw_gray(origin, self.cell[:,0], self.cell[:,1], self.repetitions[0], self.repetitions[1], self.cell[:,2], self.repetitions[2]) draw_gray(origin, self.cell[:,1], self.cell[:,2], self.repetitions[1], self.repetitions[2], self.cell[:,0], self.repetitions[0]) draw_gray(origin, self.cell[:,2], self.cell[:,0], self.repetit... | repetitions = self.repetitions*self.cell_active if self.cell_active[2]: draw_gray(origin, self.cell[:,0], self.cell[:,1], repetitions[0], repetitions[1], self.cell[:,2], repetitions[2]) if self.cell_active[0]: draw_gray(origin, self.cell[:,1], self.cell[:,2], repetitions[1], repetitions[2], self.cell[:,0], repetitions[... | def draw_gray(origin, axis1, axis2, n1, n2, delta, nd): set_color(gray, gray, gray) if n1 == 0 and n2 == 0: return for i1 in xrange(n1+1): if i1 == 0: b2 = 1 draw_line(origin+delta, origin+nd*delta) else: b2 = 0 for i2 in xrange(b2, n2+1): draw_line(origin+i1*axis1+i2*axis2, origin+i1*axis1+i2*axis2+nd*delta) |
repetitions = (self.repetitions + 2) * self.cell_active + 1 - self.cell_active | if self.clipping: repetitions = (self.repetitions + 2) * self.cell_active + 1 - self.cell_active else: repetitions = self.repetitions * self.cell_active + 1 - self.cell_active | def revalidate_total_list(self): if self.gl_active > 0: ##print "Compiling total list (%i): %s" % (self.total_list, self.get_name()) glNewList(self.total_list, GL_COMPILE) if self.visible: glPushName(self.draw_list) if self.box_visible: glCallList(self.box_list) if self.selected and sum(self.cell_active) == 0: glCallLi... |
t = numpy.dot(self.cell, numpy.array(position)-self.cell_active) | t = numpy.dot(self.cell, numpy.array(position)-self.cell_active*self.clipping) | def revalidate_total_list(self): if self.gl_active > 0: ##print "Compiling total list (%i): %s" % (self.total_list, self.get_name()) glNewList(self.total_list, GL_COMPILE) if self.visible: glPushName(self.draw_list) if self.box_visible: glCallList(self.box_list) if self.selected and sum(self.cell_active) == 0: glCallLi... |
first = referenct.children[0].target | first = referent.children[0].target | def yield_neighbours(self): Bond = context.application.plugins.get_node("Bond") for reference in self.references: referent = reference.parent if isinstance(referent, Bond): first = referenct.children[0].target if first == self: neighbour = referenct.children[1].target else: neighbour = first if isinstance(neighbour, At... |
neighbour = referenct.children[1].target | neighbour = referent.children[1].target | def yield_neighbours(self): Bond = context.application.plugins.get_node("Bond") for reference in self.references: referent = reference.parent if isinstance(referent, Bond): first = referenct.children[0].target if first == self: neighbour = referenct.children[1].target else: neighbour = first if isinstance(neighbour, At... |
new_unit_cell = MolmodUnitCell() | new_unit_cell = UnitCell() | def do(self): vectors = context.application.cache.nodes universe = context.application.model.root[0] new_unit_cell = MolmodUnitCell() new_unit_cell.cell_active = copy.deepcopy(universe.cell_active) new_unit_cell.cell = copy.deepcopy(universe.cell) try: for vector in vectors: new_unit_cell.add_cell_vector(vector.shortes... |
print "SLAVE", victim.get_name() print "MASTER", master.get_name() | def filter_out_high_cost(records): for record in records: #print selected_quaternion, record.quaternion cosine = numpy.dot(selected_quaternion, record.quaternion) if cosine > 1: cosine = 1 elif cosine < -1: cosine = -1 cost_function = int(math.acos(cosine)*180.0/math.pi) if cost_function < 10: record.cost_function = co... | |
print "right" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
print "left" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
print "up" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
print "down" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
print "page up, to front" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
print "page down, to back" | def key_press(self, drawing_area, event): translation = numpy.zeros(3, float) # on key press corresponds to a movement of the mouse with five pixels pixels = 5 | |
if len(model.selected_nodes) == 0: | if len(cache.nodes) == 0: | def on_drag_data_received(self, tree_view, drag_context, x, y, selection_data, info, timestamp): model = context.application.model |
for node in model.selected_nodes: source_path = model.treestore.get_path(node.iter) | for node in cache.nodes: source_path = model.get_path(node.iter) | def on_drag_data_received(self, tree_view, drag_context, x, y, selection_data, info, timestamp): model = context.application.model |
destination_iter = model.treestore.get_iter(destination_path) destination = model.treestore.get_value(destination_iter, 0) | destination_iter = model.get_iter(destination_path) destination = model.get_value(destination_iter, 0) | def on_drag_data_received(self, tree_view, drag_context, x, y, selection_data, info, timestamp): model = context.application.model |
toggle_button.set_alignment(1.0, 0.0) | if self.buttons != NO_BUTTONS: | def create_widgets(self): Group.create_widgets(self) self.container = gtk.Table(1, 3) self.container.set_row_spacings(6) self.container.set_col_spacings(6) self.container.set_border_width(self.table_border_width) last_row = 0 first_edit = 0 if self.label is not None: self.container.resize(1, self.container.get_property... |
toggle_button.connect("toggled", self.on_button_toggled, field) | def create_widgets(self): Group.create_widgets(self) self.container = gtk.Table(1, 3) self.container.set_row_spacings(6) self.container.set_col_spacings(6) self.container.set_border_width(self.table_border_width) last_row = 0 first_edit = 0 if self.label is not None: self.container.resize(1, self.container.get_property... | |
if self.parameters.empty(): | if self.parameters is None: self.parameters = Parameters() | def __init__(self, parameters=None): RememberParametersMixin.__init__(self, parameters) Base.__init__(self) if self.parameters.empty(): self.interactive_init() else: try: self.immediate_do() context.application.action_manager.end_current_action() except UserError, e: e.show_message() if context.application.action_manag... |
mpl_widget = matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg(figure) mpl_widget.set_size_request(400, 400) self.hb_images.pack_start(mpl_widget, expand=False, fill=True) | self.mpl_widget = matplotlib.backends.backend_gtkagg.FigureCanvasGTKAgg(figure) self.mpl_widget.set_size_request(400, 400) self.hb_images.pack_start(self.mpl_widget, expand=False, fill=True) | def __init__(self): GladeWrapper.__init__(self, "plugins/molecular/gui.glade", "di_distribution", "dialog") self.dialog.hide() self.init_callbacks(DistributionDialog) self.init_proxies(["hb_images", "tv_properties"]) |
c = copy.deepcopy(self.frame1.transformation) c.apply_after(model.get_value(iter, 2)[1]) primitive.SetProperty(self.frame2, "transformation", c) | old_transformation = copy.deepcopy(self.frame2.transformation) self.frame2.transformation.clear() transformation = self.frame1.get_frame_relative_to(self.frame2) transformation.apply_before(model.get_value(iter, 2)[1]) self.frame2.set_transformation(transformation) primitive.SetProperty(self.frame2, "transformation", ... | def apply_normal(self): model, iter = self.tree_selection.get_selected() c = copy.deepcopy(self.frame1.transformation) c.apply_after(model.get_value(iter, 2)[1]) primitive.SetProperty(self.frame2, "transformation", c) |
if self.field.transpose: value = value.transpose() | def fill_menu(self): Default.fill_menu(self) representation = self.field.read_from_widget() from mixin import ambiguous if representation == ambiguous: return self.add_separator() try: value = self.field.convert_to_value(representation) if isinstance(value, numpy.ndarray): if self.field.transpose: value = value.transpo... | |
indenter.write_line("<none%s/>") | indenter.write_line("<none%s/>" % name_key) | def dump_stage3(indenter, node, use_references, name=None): cls = type(node) if cls == types.InstanceType: cls = node.__class__ # For old style stuff |
self.unset_clip_planes() self.set_clip_planes() | if self.gl_active > 0: self.unset_clip_planes() self.set_clip_planes() | def update_clip_planes(self): self.unset_clip_planes() self.set_clip_planes() |
gtk.TreeStore.__init__(self, ModelBase) | gtk.TreeStore.__init__(self, NodeBase) | def __init__(self): ModelBase.__init__(self) gtk.TreeStore.__init__(self, ModelBase) |
if measure.endswith(suffices[unit].lower()): | if s.endswith(suffices[unit].lower()): | def eval_measure(s, measure): s = s.lower().strip() suffix_unit = None for unit in units_by_measure[measure]: if measure.endswith(suffices[unit].lower()): s = s[:-len(suffices[unit])] suffix_unit = unit break if suffix_unit is None: suffix_unit = context.application.configuration.default_units[measure] return from_uni... |
print >> f, value | print >> f, to_unit[self.unit](value) | def save_data(self, filename): f = file(filename, "w") for line in self.comments: print >> f, "#", line for value in self.data: print >> f, value f.close() |
e = helper.children[0].translation_relative_to(self.victim.parent) | e = helper.children[1].translation_relative_to(self.victim.parent) | def interactive_init(self): InteractiveWithMemory.interactive_init(self) nodes = context.application.cache.nodes self.victim = nodes[0] self.rotation_axis = None self.changed = False rotation_center_object = None if len(nodes) == 2: helper = nodes[1] # take the information out of the helper nodes if isinstance(helper, ... |
rotation_center_object.helper.children[0].target | rotation_center_object = helper.children[0].target | def interactive_init(self): InteractiveWithMemory.interactive_init(self) nodes = context.application.cache.nodes self.victim = nodes[0] self.rotation_axis = None self.changed = False rotation_center_object = None if len(nodes) == 2: helper = nodes[1] # take the information out of the helper nodes if isinstance(helper, ... |
indenter.write_line("<reference to='%id' />" % identifiers[node]) | indenter.write_line("<reference to='%i' />" % identifiers[node]) | def dump_stage3(indenter, node, use_references, name=None): cls = type(node) if cls == types.InstanceType: cls = node.__class__ # For old style stuff |
express_measure(self.average, self.measure) | express_measure(self.average, self.measure, decimals) | def calculate_properties(self): self.average = self.data.mean() self.median = numpy.median(self.data) self.stdev = math.sqrt(sum((self.data - self.data.mean())**2) / (len(self.data) - 1)) |
express_measure(self.median, self.measure) | express_measure(self.median, self.measure, decimals) | def calculate_properties(self): self.average = self.data.mean() self.median = numpy.median(self.data) self.stdev = math.sqrt(sum((self.data - self.data.mean())**2) / (len(self.data) - 1)) |
express_measure(self.stdev, self.measure) | express_measure(self.stdev, self.measure, decimals) | def calculate_properties(self): self.average = self.data.mean() self.median = numpy.median(self.data) self.stdev = math.sqrt(sum((self.data - self.data.mean())**2) / (len(self.data) - 1)) |
val.variable = key[:4] | val.variable = key[7:11] | def do(self): for key, val in self.parameters.__dict__.iteritems(): if isinstance(val, Expression): val.compile_as("<%s>" % key) val.variable = key[:4] |
def save_svg(self, filename): old_backend = matplotlib.rcParams["backend"] matplotlib.rcParams["backend"] = "SVG" pylab.figure(0) pylab.savefig(filename, dpi=100) matplotlib.rcParams["backend"] = old_backend | def save_data(self, filename): f = file(filename, "w") for line in self.comments: print >> f, " for value in self.data: print >> f, to_unit[self.unit](value) f.close() | def save_svg(self, filename): old_backend = matplotlib.rcParams["backend"] matplotlib.rcParams["backend"] = "SVG" pylab.figure(0) pylab.savefig(filename, dpi=100) matplotlib.rcParams["backend"] = old_backend |
scene.rotation_center.t[:2] += transformed_vector[:2] | scene.rotation_center.t += transformed_vector | def do_translation(self, vector, drawing_area): scene = drawing_area.scene tmp = vector.copy() tmp[2] = 0 transformed_vector = numpy.dot(self.eye_to_model_rotation, tmp) scene.viewer.t[:2] -= vector[:2] scene.rotation_center.t[:2] += transformed_vector[:2] if (scene.opening_angle > 0): scene.viewer.t[2] -= vector[2] sc... |
print self.first_hit, self.last_hit | def button_release(self, drawing_area, event): drawing_area.tool_clear() self.end_x = event.x self.end_y = event.y | |
def release_gl(self): GLPeriodicContainer.release_gl(self) | def cleanup_gl(self): GLPeriodicContainer.cleanup_gl(self) | def release_gl(self): GLPeriodicContainer.release_gl(self) ##print "Deleting box list (%i): %s" % (self.box_list, self.get_name()) glDeleteLists(self.box_list, 1) del self.box_list del self.box_list_valid self.unset_clip_planes() |
self.invalidate_draw_list() | self.invalidate_box_list() | def set_selected(self, selected): GLPeriodicContainer.set_selected(self, selected) self.invalidate_draw_list() |
def extend_bounding_box(self, bounding_box): | def revalidate_bounding_box(self): | def extend_bounding_box(self, bounding_box): GLPeriodicContainer.revalidate_bounding_box(self) FrameAxes.extend_bounding_box(self, self.bounding_box) |
cache = context.application.cache if cache.parent is None: return False | cache = context.application.cache | def analyze_selection(parameters=None): # A) calling ancestor if not ImmediateWithMemory.analyze_selection(parameters): return False cache = context.application.cache if cache.parent is None: return False if len(cache.translated_nodes) == 0: return False if cache.some_nodes_fixed: return False # B) validating # C) pass... |
b = last.children[0].translation_relative_to(cache.parent) e = last.children[1].translation_relative_to(cache.parent) | b = last.children[0].translation_relative_to(parent) e = last.children[1].translation_relative_to(parent) | def ask_parameters(self): cache = context.application.cache last = cache.last if isinstance(last, Vector): b = last.children[0].translation_relative_to(cache.parent) e = last.children[1].translation_relative_to(cache.parent) if (b is not None) and (e is not None): self.parameters.translation.t = e - b else: self.use_la... |
self.viewer.gl_apply() | self.viewer.gl_apply_inverse() | def draw(self, selection_box=None): # gl_context sensitive method # This function is called when the color and depth buffers have to be # refreshed, or when the user points to an object and you want to # identify it. viewport = glGetIntegerv(GL_VIEWPORT) width = viewport[2] height = viewport[3] |
self.viewer.translation_vector[2] = -config.viewer_distance | self.viewer.translation_vector[2] = config.viewer_distance | def reset_view(self): config = context.application.configuration self.center = Translation() self.rotation = Rotation() self.viewer = Translation() self.viewer.translation_vector[2] = -config.viewer_distance self.opening_angle = config.opening_angle self.window_size = config.window_size self.window_depth = config.windo... |
self.menu.popup(None, None, bottom_left, mouse_button, time) | self.menu.popup(None, None, top_right, mouse_button, time) | def top_right(menu): xo, yo = button.window.get_origin() return ( xo + button.allocation.x + button.allocation.width, yo + button.allocation.y, False ) |
"Convert to %s (%f)" % (unit_suffix, alternative_representation), | "Convert to %s" % alternative_representation, | def fill_menu(self): representation = self.field.read_from_widget() from mixin import ambiguous if representation == ambiguous: return self.add_separator() try: length = self.field.convert_to_value(representation) for UNIT in measures[LENGTH]: unit_suffix = suffices[UNIT] alternative_representation = express_measure(le... |
return -scene.viewer.translation_vector[2] + scene.znear() | return -scene.viewer.translation_vector[2] - scene.znear() | def get_victim_depth(self, drawing_area): scene = drawing_area.scene return -scene.viewer.translation_vector[2] + scene.znear() |
for published_property in self.published_properties.itervalues(): published_property.set(self, published_property.get(self)) | for name, published_property in self.published_properties.iteritems(): value = self.__dict__[name] self.__dict__[name] = published_property.get_default(self) published_property.set(self, value) | def initstate(self, **initstate): # initialisation of published properties for name, published_property in self.published_properties.iteritems(): value = initstate.get(name) if value is None: value = published_property.get_default(self) self.__dict__[name] = value for published_property in self.published_properties.ite... |
print "ON ", self.attribute_name, id(self), self.label_text | def update_label(self): if self.label is None: return if self.changed(): print "ON ", self.attribute_name, id(self), self.label_text if len(self.label.get_label()) == len(self.label_text): self.label.set_label(self.label_text + changed_indicator) else: print "OFF", self.attribute_name, id(self), self.label_text if len(... | |
print "OFF", self.attribute_name, id(self), self.label_text | def update_label(self): if self.label is None: return if self.changed(): print "ON ", self.attribute_name, id(self), self.label_text if len(self.label.get_label()) == len(self.label_text): self.label.set_label(self.label_text + changed_indicator) else: print "OFF", self.attribute_name, id(self), self.label_text if len(... | |
tensor += ( mass*numpy.dot(delta, delta)*numpy.identity(3, float) -numpy.outerproduct(delta, delta) | tensor += mass*( numpy.dot(delta, delta)*numpy.identity(3, float) -numpy.outer(delta, delta) | def calculate_inertia_tensor(particles, center): tensor = numpy.zeros((3,3), float) for mass, coordinate in particles: delta = coordinate - center tensor += ( mass*numpy.dot(delta, delta)*numpy.identity(3, float) -numpy.outerproduct(delta, delta) ) return tensor |
Popup = popups.Default | def create_widgets(self): Composed.create_widgets(self) table = gtk.Table(self.suffices.shape[0], self.suffices.shape[1]*4 - 1) table.set_row_spacings(6) table.set_col_spacings(6) for row_index, row in enumerate(self.fields_array): for col_index, field in enumerate(row): if field.high_widget: if self.short: container =... | |
Popup = popups.Default | def write_to_attribute(self, value): self.attribute.set_rotation_properties(value[0], value[1], value[2]) | |
Popup = popups.Default | def convert_to_value(self, representation): intermediate = Array.convert_to_value(self, representation) check_cell(intermediate) return intermediate | |
Popup = popups.Default | def __init__(self, label_text=None, attribute_name=None, show_popup=True, history_name=None, show_field_popups=False): Array.__init__( self, FieldClass=CheckButton, array_name="Active in %s direction", suffices=("A", "B", "C"), label_text=label_text, attribute_name=attribute_name, show_popup=show_popup, history_name=hi... | |
Popup = popups.Translation | Popup = popups.Default | def __init__(self, label_text=None, attribute_name=None, show_popup=True, history_name=None, show_field_popups=False): Array.__init__( self, FieldClass=Int, array_name="repetitions along %s", suffices=("A", "B", "C"), label_text=label_text, attribute_name=attribute_name, show_popup=show_popup, history_name=history_name... |
if line[:1] == "-": | if line[:2] == "- ": | def addLine(self, line): line = line.strip() |
result = result.replace(">", ">"); | result = result.replace(">", ">"); result = re.sub(r"([Bb]ug)\s+(\d{6,})", '<a href="http://sourceforge.net/tracker/index.php?func=detail&aid=\\2&group_id=18598&atid=118598">\\1 \\2</a>', result) result = re.sub(r"([Rr]equest)\s+(\d{6,})", '<a href="http://sourceforge.net/tracker/index.php?func=detail&am... | def quote(line): result = line.replace(chr(0x0a), "") result = result.replace("&", "&"); result = result.replace("<", "<"); result = result.replace(">", ">"); return result |
inputStream.close() file.close() return filename def saveBinaryToFile (prefix, response, grinder): inputStream = response.getInputStream() filename = grinder.getFilenameFactory().createFilename(prefix + "_page", "-%d.html" % grinder.runNumber) file = open(filename, "bw") i = 1 taille = inputStream.available() while (... | def saveHtmlToFile (prefix, response, grinder): inputStream = response.getInputStream() filename = grinder.getFilenameFactory().createFilename(prefix + "_page", "-%d.html" % grinder.runNumber) file = open(filename, "w") i = 1 taille = inputStream.available() while (i <= taille): c = inputStream.read() file.write("%c" %... | |
i = 0 | def process_file(file='/tmp/liste'): '''Lecture du fichier contenant la liste a envoyer sur l'autre machine ''' import popen2 global processflag, debug if debug == 'true': sys.stderr.write("DEBUG : process_file (flag=%s)\n" % processflag) if processflag == 'no' : sys.stderr.write("ERROR : Processing already engaged !... | |
data = f.read().split('\n') i = len(data) while 0 < i: i -= 1 if data[0] <> '': sys.stdout.write("Sending \"%s\"\n" % data[0]) cmd = command % data[0] if debug == 'true': sys.stdout.write("DEBUG : command=%s" % cmd) | for data in f.read().split('\n'): if data <> '': sys.stdout.write("Working on: \"%s\"\n" % data) cmd = command % data if debug == 'true': sys.stdout.write("DEBUG : command=%s\n" % cmd) | def process_file(file='/tmp/liste'): '''Lecture du fichier contenant la liste a envoyer sur l'autre machine ''' import popen2 global processflag, debug if debug == 'true': sys.stderr.write("DEBUG : process_file (flag=%s)\n" % processflag) if processflag == 'no' : sys.stderr.write("ERROR : Processing already engaged !... |
del data[0] | def process_file(file='/tmp/liste'): '''Lecture du fichier contenant la liste a envoyer sur l'autre machine ''' import popen2 global processflag, debug if debug == 'true': sys.stderr.write("DEBUG : process_file (flag=%s)\n" % processflag) if processflag == 'no' : sys.stderr.write("ERROR : Processing already engaged !... | |
return XmlDir(chumproot+os.path.sep+datetime.datetime.now().strftime("%Y/%02m/%02d"),xsldir)._q_index(request) | return XmlFile(chumproot+os.path.sep+"index.xml","html",xsldir)._q_index(request) | def _q_index(request): return XmlDir(chumproot+os.path.sep+datetime.datetime.now().strftime("%Y/%02m/%02d"),xsldir)._q_index(request) |
print "!" | def _q_index(request): print "!" return XmlDir(chumproot+os.path.sep+datetime.datetime.now().strftime("%Y/%02m/%02d"),xsldir)._q_index(request) | |
if (use_x_z): fout.write(" fout.write(" else: fout.write(" fout.write(" fout.close() | def fullfactor(n): facs=range(3) [nleft,facs[0]]=nfactor(n,2) [nleft,facs[1]]=nfactor(nleft,3) [nleft,facs[2]]=nfactor(nleft,5) if (nleft<>1): print "dimension: ",n[i],"must only have factors of 2,3 and 5" sys.exit(1) if n<>1 and n<=4: print "dimension: ",n,"must be > 4" sys.exit(1) return facs | |
print "n[",i,"]",n[i],"not divisable by ncpu[",i,"]=",ncpu[i] | print "ERROR: n[",i,"]",n[i],"not divisable by ncpu[",i,"]=",ncpu[i] | def fullfactor(n): facs=range(3) [nleft,facs[0]]=nfactor(n,2) [nleft,facs[1]]=nfactor(nleft,3) [nleft,facs[2]]=nfactor(nleft,5) if (nleft<>1): print "WARNING: dimension: ",n,"must only have factors of 2,3 and 5" |
patch_file = join(buildenv.distdir, '0install/from-%s.patch' % orig_impl.get_version()) | patch_file = join(buildenv.metadir, 'from-%s.patch' % orig_impl.get_version()) | def do_build_internal(args): """build-internal""" import getpass, socket, time buildenv = BuildEnv() builddir = os.path.realpath('build') ensure_dir(buildenv.metadir) # Create build-environment.xml file root = buildenv.doc.documentElement info = buildenv.doc.createElementNS(XMLNS_0COMPILE, 'build-info') root.appendC... |
buildenv.doc.writexml(file(join(buildenv.metadir, 'build-environment.xml'), 'w')) | stream = file(build_env_xml, 'w') buildenv.doc.writexml(stream) stream.close() | def do_build_internal(args): """build-internal""" import getpass, socket, time buildenv = BuildEnv() builddir = os.path.realpath('build') ensure_dir(buildenv.metadir) # Create build-environment.xml file root = buildenv.doc.documentElement info = buildenv.doc.createElementNS(XMLNS_0COMPILE, 'build-info') root.appendC... |
write_sample_interface(src_iface, buildenv.local_iface_file, buildenv.chosen_impl(buildenv.interface)) | src_impl = buildenv.chosen_impl(buildenv.interface) write_sample_interface(src_iface, buildenv.local_iface_file, src_impl) | def do_build_internal(args): """build-internal""" import getpass, socket, time buildenv = BuildEnv() builddir = os.path.realpath('build') ensure_dir(buildenv.metadir) # Create build-environment.xml file root = buildenv.doc.documentElement info = buildenv.doc.createElementNS(XMLNS_0COMPILE, 'build-info') root.appendC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.