rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
self.ParseHWI() self.ReadAll() self.connect(self.obj.btStore, QtCore.SIGNAL('clicked()'), self.onStoreEeprom) self.connect(self.obj.btLoad, QtCore.SIGNAL('clicked()'), self.onLoadEeprom) self.connect(self.obj.btSet, QtCore.SIGNAL('clicked()'), self.onSet) self.connect(self.obj.btGet, QtCore.SIGNAL('clicked()'...
def getGpsAut(self): return self.getGps("AUT")
def __init__(self, device=None): QtGui.QWidget.__init__(self) self.obj = Ui_Basic() self.obj.setupUi(self) self.dev = device
self.context = context self.request = request
BrowserView.__init__(self, context, request)
def __init__(self, context, request): self.context = context self.request = request self.siteInfo = createObject('groupserver.SiteInfo', context) self.groupInfo = createObject('groupserver.GroupInfo', context) self.profileList = ProfileList(context) self.acl_users = context.site_root().acl_users site_root = context.s...
getattr(interfaces, profileSchemaName)
getattr(profileSchemas, profileSchemaName)
def __init__(self, context, request): self.context = context self.request = request self.siteInfo = createObject('groupserver.SiteInfo', context) self.groupInfo = createObject('groupserver.GroupInfo', context) self.profileList = ProfileList(context) self.acl_users = context.site_root().acl_users site_root = context.s...
assert hasattr(interfaces, profileSchemaName), \
assert hasattr(profileSchemas, profileSchemaName), \
def __init__(self, context): self.context = context self.__properties = ODict()
self.__schema = getattr(interfaces, profileSchemaName)
self.__schema = getattr(profileSchemas, profileSchemaName)
def __init__(self, context): self.context = context self.__properties = ODict()
config = site_root.GlobalConfiguration self.profileSchemaName = profileSchemaName = \ config.getProperty('profileInterface', 'IGSCoreProfile') self.profileSchema = profileSchema = \ getattr(profileSchemas, profileSchemaName) self.profileFields = form.Fields(self.profileSchema, render_context=False)
def __init__(self, context, request): BrowserView.__init__(self, context, request)
self.__fromAddr = None
self.__fromAddr = self.__profileInterfaceName = None self.__profileFields = None @property def profileSchemaName(self): if self.__profileInterfaceName == None: site_root = self.context.site_root() assert hasattr(site_root, 'GlobalConfiguration') config = site_root.GlobalConfiguration ifName = config.getProperty('profi...
def __init__(self, context, request): BrowserView.__init__(self, context, request)
site_root = context.site_root() assert hasattr(site_root, 'GlobalConfiguration') config = site_root.GlobalConfiguration profileSchemaName = config.getProperty('profileInterface', 'IGSCoreProfile') profileSchemaName = '%sAdminJoinCSV' % profileSchemaName assert hasattr(profileSchemas, profileSchemaName), \ 'Interface ...
self.__profileInterfaceName = None @property def profileSchemaName(self): if self.__profileInterfaceName == None: site_root = self.context.site_root() assert hasattr(site_root, 'GlobalConfiguration') config = site_root.GlobalConfiguration ifName = config.getProperty('profileInterface', 'IGSCoreProfile') ifName = (ifN...
def __init__(self, context): self.context = context self.__properties = ODict()
audit = Auditor()
def process_form(self): form = self.context.REQUEST.form result = {} result['form'] = form
assert type(columns) == dict
assert type(columns) == list, \ 'Got a %s as columns, expected a list' % type(columns)
def process_csv_results(self, csvResults, columns, delivery): '''Process the CSV results, creating users and adding them to the group as necessary. ARGUMENTS csvResults: The CSV results, as generated by "process_csv_file" columns: The columns specification, as generated by "process_columns". delivery: The email d...
r = self.process_row(row, delivery)
r = self.process_row(row, columns, delivery)
def process_csv_results(self, csvResults, columns, delivery): '''Process the CSV results, creating users and adding them to the group as necessary. ARGUMENTS csvResults: The CSV results, as generated by "process_csv_file" columns: The columns specification, as generated by "process_columns". delivery: The email d...
userUsers = existingUserCount == 1 and 'user' or 'users'
userUsers = existingUserCount == 1 and 'person' or 'people'
def process_csv_results(self, csvResults, columns, delivery): '''Process the CSV results, creating users and adding them to the group as necessary. ARGUMENTS csvResults: The CSV results, as generated by "process_csv_file" columns: The columns specification, as generated by "process_columns". delivery: The email d...
u'<a href=" u'%s</strong> %s invited to join to %s.</a>\n'\
u'<a href=" u'<strong>already had a profile</strong> %s invited to '\ u'join to %s.</a>\n'\
def process_csv_results(self, csvResults, columns, delivery): '''Process the CSV results, creating users and adding them to the group as necessary. ARGUMENTS csvResults: The CSV results, as generated by "process_csv_file" columns: The columns specification, as generated by "process_columns". delivery: The email d...
def process_row(self, row, delivery):
def process_row(self, row, columns, delivery):
def process_row(self, row, delivery): '''Process a row from the CSV file ARGUMENTS row dict The fields representing a row in the CSV file. The column identifiers (alias profile attribute identifiers) form the keys. delivery str The message delivery settings for the new group members
inviteId = inviter.create_invitation(data, True)
inviteId = inviter.create_invitation(row, False)
def process_row(self, row, delivery): '''Process a row from the CSV file ARGUMENTS row dict The fields representing a row in the CSV file. The column identifiers (alias profile attribute identifiers) form the keys. delivery str The message delivery settings for the new group members
inviter.send_notification(self.subject, self.get_message,
inviter.send_notification(self.subject, self.message,
def process_row(self, row, delivery): '''Process a row from the CSV file ARGUMENTS row dict The fields representing a row in the CSV file. The column identifiers (alias profile attribute identifiers) form the keys. delivery str The message delivery settings for the new group members
m = u'Invited existing user %s' % userInfo_to_anchor(userInfo)
m = u'%s has an existing profile' % userInfo_to_anchor(userInfo)
def process_row(self, row, delivery): '''Process a row from the CSV file ARGUMENTS row dict The fields representing a row in the CSV file. The column identifiers (alias profile attribute identifiers) form the keys. delivery str The message delivery settings for the new group members
auditor, inviter = self.get_auditor_inviter(userInfo) inviteId = inviter.create_invitation(row, True) auditor.info(INVITE_NEW_USER, email) inviter.send_notification(self.subject, self.message, inviteId, self.fromAddr, email)
def process_row(self, row, delivery): '''Process a row from the CSV file ARGUMENTS row dict The fields representing a row in the CSV file. The column identifiers (alias profile attribute identifiers) form the keys. delivery str The message delivery settings for the new group members
user = utils.create_user_from_email(self.context, email)
user = create_user_from_email(self.context, email)
def create_user(self, fields): assert type(fields) == dict assert 'toAddr' in fields assert fields['toAddr'] email = fields['toAddr'].strip() user = utils.create_user_from_email(self.context, email) userInfo = IGSUserInfo(user) # Add profile attributes utils.enforce_schema(user, self.profileSchema) changed = form.app...
utils.enforce_schema(user, self.profileSchema)
enforce_schema(userInfo.user, self.profileSchema)
def create_user(self, fields): assert type(fields) == dict assert 'toAddr' in fields assert fields['toAddr'] email = fields['toAddr'].strip() user = utils.create_user_from_email(self.context, email) userInfo = IGSUserInfo(user) # Add profile attributes utils.enforce_schema(user, self.profileSchema) changed = form.app...
inviter = Inviter(self.context, self.request, userInfo,
ctx = get_the_actual_instance_from_zope(self.context) inviter = Inviter(ctx, self.request, userInfo,
def get_auditor_inviter(self, userInfo): print 'InviteEditProfileForm.get_auditor_inviter' print '\tsiteInfo %s' % self.siteInfo.name inviter = Inviter(self.context, self.request, userInfo, self.adminInfo, self.siteInfo, self.groupInfo) auditor = Auditor(self.siteInfo, self.groupInfo, self.adminInfo, userInfo) return (...
self.__groupInfo = \ createObject('groupserver.GroupInfo', self.context)
ctx = get_the_actual_instance_from_zope(self.context) self.__groupInfo = createObject('groupserver.GroupInfo', ctx)
def groupInfo(self): if self.__groupInfo == None: self.__groupInfo = \ createObject('groupserver.GroupInfo', self.context) return self.__groupInfo
'Interface "%s" not found.' % adminInterfaceName
'Interface "%s" not found.' % ifName
def profileInterfaceName(self): if self.__profileInterfaceName == None: ifName = self.config.getProperty('profileInterface', 'IGSCoreProfile') # --=mpj17=-- Sometimes profileInterface is set to '' ifName = (ifName and ifName) or 'IGSCoreProfile' assert hasattr(interfaces, ifName), \ 'Interface "%s" not found.' % adminI...
s.append_whereclause(uit.c.withdrawn_date == None)
s.append_whereclause(it.c.withdrawn_date == None)
def get_only_invitation(self, userInfo): it = self.userInvitationTable s = it.select() s.append_whereclause(it.c.response_date == None) s.append_whereclause(uit.c.withdrawn_date == None) s.append_whereclause(it.c.user_id == userInfo.id )
"""Insert an element into the spatial tree. :param element: the element to be stored in the retrieval data structure. It is treated as opaque and no assumptions are made on it. :param bbox: A bounding box supplied as a tuple *lower_left, upper_right* of :mod:`numpy` vectors, such that *(lower_right <= upper_right).all(...
"""Insert an element into the spatial tree.
def insert(self, element, bbox): """Insert an element into the spatial tree.
Despite these names, the bounding box (and this entire data structure) may be of any dimension.
:param element: the element to be stored in the retrieval data structure. It is treated as opaque and no assumptions are made on it. :param bbox: A bounding box supplied as a tuple *lower_left, upper_right* of :mod:`numpy` vectors, such that *(lower_right <= upper_right).all()*. Despite these names, the bounding box...
def insert(self, element, bbox): """Insert an element into the spatial tree.
from os.path import basename
def __init__(self, moniker, main_file, aux_files=[], timestamp=None): import os import os.path
by this L{MultiLogQuantity}."""
by this L{MultiLogQuantity}. This is only called if the invocation interval calls for it. """
def __call__(self): """Return an iterable of the current values of the diagnostic represented by this L{MultiLogQuantity}.""" raise NotImplementedError
rawf.seek(0) rarf.seek(0) read_bytes = 1000 print "RAW:", rawf.read(read_bytes) print "RAR:", rarf.read(read_bytes) self.assertEqual(rarf.read(read_bytes), rawf.read(read_bytes), 'mismatch in sequential read')
self.assertEqual(rarf.read(), rawf.read(), 'mismatch in sequential read')
def verify_read_sequential(self, rar_file, raw_file): file_size = os.path.getsize(raw_file) rawf = open(raw_file, 'r') rarf = open(rar_file, 'r')
print "RAW file: " + raw_file print "RAR file: " + rar_file
def verify_read_random_from_start(self, rar_file, raw_file): file_size = os.path.getsize(raw_file) rarf = open(rar_file, 'r') rawf = open(raw_file, 'r') print "RAW file: " + raw_file print "RAR file: " + rar_file read_bytes = 10 for i in xrange(0, 10000): # get random number rb = random.randrange(0, file_size-10) # ali...
read_bytes = 10
def verify_read_random_from_start(self, rar_file, raw_file): file_size = os.path.getsize(raw_file) rarf = open(rar_file, 'r') rawf = open(raw_file, 'r') read_bytes = 10 for i in xrange(0, 10000): # get random number rb = random.randrange(0, file_size-10) # align on 10 char boundary byte = rb - ((rb + 10) % 10) # make e...
rb = random.randrange(0, file_size-10) byte = rb - ((rb + 10) % 10) if file_size <= 10: byte = 0 read_bytes = file_size
byte = random.randrange(0, file_size)
def verify_read_random_from_start(self, rar_file, raw_file): file_size = os.path.getsize(raw_file) rarf = open(rar_file, 'r') rawf = open(raw_file, 'r') read_bytes = 10 for i in xrange(0, 10000): # get random number rb = random.randrange(0, file_size-10) # align on 10 char boundary byte = rb - ((rb + 10) % 10) # make e...
self.assertEqual(rarf.read(read_bytes), rawf.read(read_bytes), 'mismatch in random read')
self.assertEqual(rarf.read(1), rawf.read(1), 'mismatch in random read')
def verify_read_random_from_start(self, rar_file, raw_file): file_size = os.path.getsize(raw_file) rarf = open(rar_file, 'r') rawf = open(raw_file, 'r') read_bytes = 10 for i in xrange(0, 10000): # get random number rb = random.randrange(0, file_size-10) # align on 10 char boundary byte = rb - ((rb + 10) % 10) # make e...
print >> sys.stderr, "Warning: msgid '%s' in %s already exists " \
print >> sys.stderr, (u"Warning: msgid '%s' in %s already exists " \
def translate(self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None):
(msgid, self.file+':'+str(position), msgid.default, existing_msgid.default, references)
(msgid, self.file+':'+str(position), msgid.default.encode('utf-8'), existing_msgid.default.encode('utf-8'), references)).encode('utf-8')
def translate(self, msgid, domain=None, mapping=None, default=None, # Position is not part of the ITALExpressionEngine # interface position=None):
editor.clear_data(editor)
editor.clear_data()
def _btn_ok_on_click(self, evt): """ Add new or update existing event.
def handle_invalid_name(self):
def handle_invalid_name(self, name):
def handle_invalid_name(self): msg = _("Category name '%s' not valid. Must be non-empty.") _display_error_message(msg % name, self) _set_focus_and_select(self.txt_name)
def handle_used_name(self):
def handle_used_name(self, name):
def handle_used_name(self): msg = _("Category name '%s' already in use.") _display_error_message(msg % name, self) _set_focus_and_select(self.txt_name)
self.view.handle_invalid_name()
self.view.handle_invalid_name(new_name)
def save(self): try: new_name = self.view.get_name() new_color = self.view.get_color() if not self._name_valid(new_name): self.view.handle_invalid_name() return if self._name_in_use(new_name): self.view.handle_used_name() return if self.category is None: self.category = Category(new_name, new_color, True) else: self.ca...
self.view.handle_used_name()
self.view.handle_used_name(new_name)
def save(self): try: new_name = self.view.get_name() new_color = self.view.get_color() if not self._name_valid(new_name): self.view.handle_invalid_name() return if self._name_in_use(new_name): self.view.handle_used_name() return if self.category is None: self.category = Category(new_name, new_color, True) else: self.ca...
self.controller.left_mouse_up(20) self.view.create_new_event.assertCalledWith(datetime(2010, 8, 30, 1, 0, 0), datetime(2010, 8, 30, 3, 0, 0))
self.controller.left_mouse_up(30) self.view.create_new_event.assert_called_with(datetime(2010, 8, 30, 1, 0, 0), datetime(2010, 8, 30, 3, 0, 0))
def testCreatesEventWhenCtrlDraggingMouse(self): self.controller.left_mouse_down(10, 0, ctrl_down=True) self.controller.mouse_moved(30, 0, left_down=True, ctrl_down=True, shift_down=False) self.controller.left_mouse_up(20) self.view.create_new_event.assertCalledWith(datetime(2010, 8, 30, 1, 0, 0), datetime(2010, 8, 30,...
self.view.create_new_event.assertCalledWith(datetime(2010, 8, 30, 2, 0, 0), datetime(2010, 8, 30, 2, 0, 0))
self.view.create_new_event.assert_called_with(datetime(2010, 8, 30, 2, 0, 0), datetime(2010, 8, 30, 2, 0, 0))
def testCreatesEventWhenDoubleClickingSurface(self): self.controller.left_mouse_dclick(20, 8, ctrl_down=False) self.view.create_new_event.assertCalledWith(datetime(2010, 8, 30, 2, 0, 0), datetime(2010, 8, 30, 2, 0, 0)) self.assertTimelineRedrawn()
self.view.edit_event.assertCalledWith(self.event_foo)
self.view.edit_event.assert_called_with(self.event_foo)
def testEditsEventWhenDoubleClickingIt(self): self.drawer.event_at.return_value = self.event_foo self.controller.left_mouse_dclick(20, 8, ctrl_down=False) self.view.edit_event.assertCalledWith(self.event_foo) self.assertTimelineRedrawn()
v = tmp_dict["version"] = (x, y, z)
tmp_dict["version"] = (x, y, z) self._create_rest_of_schema(tmp_dict)
def _parse_version(self, text, tmp_dict): match = re.search(r"^(\d+).(\d+).(\d+)(dev.*)?$", text) if match: (x, y, z) = (int(match.group(1)), int(match.group(2)), int(match.group(3))) v = tmp_dict["version"] = (x, y, z) else: raise ParseException("Could not parse version number from '%s'." % text) # Create the rest of ...
if v == (0, 10, 0): tmp_dict["partial_schema"].add_child_tags([ Tag("categories", SINGLE, None, [ Tag("category", ANY, self._parse_category, [ Tag("name", SINGLE, parse_fn_store("tmp_name")), Tag("color", SINGLE, parse_fn_store("tmp_color")), Tag("parent", OPTIONAL, parse_fn_store("tmp_parent")), ])
def _create_rest_of_schema(self, tmp_dict): """ Ensure all versions of the xml format can be parsed with this schema. tmp_dict["version"] can be used to create different schemas depending on the version. """ tmp_dict["partial_schema"].add_child_tags([ Tag("categories", SINGLE, None, [ Tag("category", ANY, self._parse_...
def _parse_version(self, text, tmp_dict): match = re.search(r"^(\d+).(\d+).(\d+)(dev.*)?$", text) if match: (x, y, z) = (int(match.group(1)), int(match.group(2)), int(match.group(3))) v = tmp_dict["version"] = (x, y, z) else: raise ParseException("Could not parse version number from '%s'." % text) # Create the rest of ...
Tag("events", SINGLE, None, [ Tag("event", ANY, self._parse_event, [ Tag("start", SINGLE, parse_fn_store("tmp_start")), Tag("end", SINGLE, parse_fn_store("tmp_end")), Tag("text", SINGLE, parse_fn_store("tmp_text")), Tag("category", OPTIONAL, parse_fn_store("tmp_category")), Tag("description", OPTIONAL, parse_fn_store("...
Tag("hidden_categories", OPTIONAL, self._parse_hidden_categories, [ Tag("name", ANY, self._parse_hidden_category),
def _parse_version(self, text, tmp_dict): match = re.search(r"^(\d+).(\d+).(\d+)(dev.*)?$", text) if match: (x, y, z) = (int(match.group(1)), int(match.group(2)), int(match.group(3))) v = tmp_dict["version"] = (x, y, z) else: raise ParseException("Could not parse version number from '%s'." % text) # Create the rest of ...
Tag("view", SINGLE, None, [ Tag("displayed_period", OPTIONAL, self._parse_displayed_period, [ Tag("start", SINGLE, parse_fn_store("tmp_start")), Tag("end", SINGLE, parse_fn_store("tmp_end")), ]), Tag("hidden_categories", OPTIONAL, self._parse_hidden_categories, [ Tag("name", ANY, self._parse_hidden_category), ]), ]), ]...
]), ])
def _parse_version(self, text, tmp_dict): match = re.search(r"^(\d+).(\d+).(\d+)(dev.*)?$", text) if match: (x, y, z) = (int(match.group(1)), int(match.group(2)), int(match.group(3))) v = tmp_dict["version"] = (x, y, z) else: raise ParseException("Could not parse version number from '%s'." % text) # Create the rest of ...
MARGIN = 10 if rect.X < -MARGIN: move = -rect.X - MARGIN rect.X += move rect.Width -= move right_edge_x = rect.X + rect.Width if right_edge_x > self.metrics.width + MARGIN: rect.Width -= right_edge_x - self.metrics.width - MARGIN
def _calc_rects(self, events): """ Calculate rectangles for all events.
return (self.config_parser.getint(DEFAULTSECT, WINDOW_XPOS), self.config_parser.getint(DEFAULTSECT, WINDOW_YPOS))
width, height = self.get_window_size() xpos = max(-width + 100, self.config_parser.getint(DEFAULTSECT, WINDOW_XPOS)) ypos = max(0, self.config_parser.getint(DEFAULTSECT, WINDOW_YPOS)) return (xpos, ypos)
def get_window_pos(self): return (self.config_parser.getint(DEFAULTSECT, WINDOW_XPOS), self.config_parser.getint(DEFAULTSECT, WINDOW_YPOS))
return ATime(0)
return (ATime(0), "can't be before 0")
def get_min_time(self): return ATime(0)
return ATime(100)
return (ATime(100), "can't be after 100")
def get_max_time(self): return ATime(100)
self.drawing_area._set_size_cursor() else: self.drawing_area._set_default_cursor()
self.drawing_area.set_size_cursor() else: self.drawing_area.set_default_cursor()
def set_cursor(self, m_x, m_y): """ Used in mouse-move events to set the size cursor before the left mouse button is pressed, to indicate that a resize is possible (if it is!). Return True if the size-indicator-cursor is set, otherwise return False. """ hit = self._hit(m_x, m_y) if hit: is_selected = self.drawing_area....
self.drawing_area._set_move_cursor() else: self.drawing_area._set_default_cursor()
self.drawing_area.set_move_cursor() else: self.drawing_area.set_default_cursor()
def set_cursor(self, m_x, m_y): """ Used in mouse-move events to set the move cursor before the left mouse button is pressed, to indicate that a move is possible (if it is!). Return True if the move-indicator-cursor is set, otherwise return False. """ hit = self._hit(m_x, m_y) if hit: is_selected = self.drawing_area.ge...
self.redraw_balloons(eventWithBalloon)
self._redraw_balloons(eventWithBalloon)
def _window_on_left_down(self, evt): """ Event handler used when the left mouse button has been pressed.
self.redraw_balloons(None)
self._redraw_balloons(None)
def _window_on_left_down(self, evt): """ Event handler used when the left mouse button has been pressed.
self._set_default_cursor()
self.set_default_cursor()
def _window_on_left_up(self, evt): """ Event handler used when the left mouse button has been released.
self._set_default_cursor()
self.set_default_cursor()
def _window_on_key_up(self, evt): keycode = evt.GetKeyCode() if keycode == wx.WXK_CONTROL: self._set_default_cursor()
self._set_default_cursor()
self.set_default_cursor()
def _set_colors_and_styles(self): """Define the look and feel of the drawing area.""" self.SetBackgroundColour(wx.WHITE) self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self._set_default_cursor() self.Disable()
self.redraw_balloons(self.current_event)
self._redraw_balloons(self.current_event)
def _on_balloon_timer1(self, event): """ Timer-1 has timed out, which means we are ready to display the balloon for the current event. """ self.timer1_running = False self.redraw_balloons(self.current_event)
self.redraw_balloons(None)
self._redraw_balloons(None)
def _on_balloon_timer2(self, event): """ Timer-2 has timed out, which means we are ready to delete the current balloon if we are no longer pointing to the current event or it's balloon. """ self.timer2_running = False hevt = self.view_properties.hovered_event # If there is no balloon visible we don't have to do anythin...
def redraw_balloons(self, event):
def _redraw_balloons(self, event):
def redraw_balloons(self, event): self.view_properties.hovered_event = event self._redraw_timeline()
def _set_size_cursor(self):
def set_size_cursor(self):
def _set_size_cursor(self): self.SetCursor(wx.StockCursor(wx.CURSOR_SIZEWE))
def _set_move_cursor(self):
def set_move_cursor(self):
def _set_move_cursor(self): self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
def _set_default_cursor(self):
def set_default_cursor(self):
def _set_default_cursor(self): """ Set the cursor to it's default shape when it is in the timeline drawing area. """ self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
text_in_first_line(file, VERSION_STR)
return text_in_first_line(file, VERSION_STR)
def version_in_first_line(file): text_in_first_line(file, VERSION_STR)
related_pages=["events", "categories"], body=_(""" The timeline shows dates according to the Gregorian calendar on the x-axis. Currently the dates are limited to dates between year 10 and year 9999.
related_pages=["events", "categories", "contact"], body=_(""" The timeline shows dates according to the Gregorian calendar on the x-axis. Currently the dates are limited to dates between year 10 and year 9989.
def install(help_system): help_system.install_page( id="contents", header=_("Help contents"), body=("""
return self.colorpicker.GetValue()
(r, g, b) = self.colorpicker.GetValue() return (r, g, b)
def get_color(self): return self.colorpicker.GetValue()
return delta * x_percent_of_width
return time_period.start_time + delta * x_percent_of_width
def get_time_at_x(self, time_period, x_percent_of_width): """Return the time at pixel `x`.""" delta = time_period.end_time - time_period.start_time return delta * x_percent_of_width
self.time_picker.SetValue(num_time)
self.time_picker.SetValue(int(round(num_time,0)))
def set_value(self, num_time): self.time_picker.SetValue(num_time)
self.time_picker.set_range(-sys.maxint - 1, sys.maxint)
def __init__(self, time_picker, default_num_time): self.time_picker = time_picker #self.time_picker.set_range(NumTimeType().get_min_time(), # NumTimeType().get_max_time()) self.default_num_time = default_num_time
dc.DrawBitmap(self.panel.bgbuf, 0, 0, True)
dc.DrawBitmap(self.panel.get_current_image(), 0, 0, True)
def SetScaleAndDeviceOrigin(dc): (panel_width, panel_height) = self.panel.GetSize() # Let's have at least 50 device units margin x_margin = 50 y_margin = 50 # Add the margin to the graphic size x_max = panel_width + (2 * x_margin) y_max = panel_height + (2 * y_margin) # Get the size of the DC in pixels (dc_width, dc_h...
self.app.manager.update_users_CM() return trans.fill_template('index.mako')
return to_json_string({'updated':self.app.manager.update_users_CM()})
def update_users_CM(self, trans): self.app.manager.update_users_CM() return trans.fill_template('index.mako')
worker_ud['password'] = self.app.ud['password']
if self.app.ud.has_key('password'): worker_ud['password'] = self.app.ud['password']
def add_instances( self, num_nodes, instance_type=''): num_nodes = int( num_nodes ) ec2_conn = self.app.cloud_interface.get_ec2_connection() log.info( "Adding %s instance(s)..." % num_nodes ) # Compose worker instance user data worker_ud = {} worker_ud['access_key'] = self.app.ud['access_key'] worker_ud['secret_key'] =...
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"):
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/galaxy-central"):
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository...
misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository)) misc.run('su galaxy -c "cd %s; sh setup.sh; sh manage_db.sh upgrade"' % (paths.P_GALAXY_HOME))
cmd = '%s - galaxy -c "cd %s; hg --config ui.merge=internal:local pull %s --update"' % (paths.P_SU, paths.P_GALAXY_HOME, repository) retval = os.system(cmd) log.debug("Galaxy update cmd '%s'; return value %s" % (cmd, retval)) cmd = '%s - galaxy -c "cd %s; sh manage_db.sh upgrade"' % (paths.P_SU, paths.P_GALAXY_HOME) re...
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository...
service.add()
service.start() log.debug("Done updating Galaxy")
def update_galaxy(self, trans, repository="http://bitbucket.org/galaxy/cloudman"): log.debug("Updating Galaxy... Using repository %s" % repository) svcs = self.app.manager.get_services('Galaxy') for service in svcs: service.remove() misc.run('su galaxy -c "cd %s; hg pull %s --update"' % (paths.P_GALAXY_HOME, repository...
<input type="text" value="http://bitbucket.org/galaxy/cloudman" name="repository">
<input type="text" value="http://bitbucket.org/galaxy/galaxy-central" name="repository">
def admin(self, trans): return """ <ul> <li>This admin panel is only a very temporary way to control galaxy services. Use with caution.</li> <li><strong>Service Control</strong></li> <li><a href='manage_galaxy'>Start Galaxy</a></li> <li><a href='manage_galaxy?to_be_started=False'>Stop Galaxy</a></li> <form action="upd...
CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" )
def get_CM_url(self, trans): CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" ) changesets = self.app.manager.check_for_new_version_of_CM() if changesets.has_key('default_CM_rev') and changesets.has_key('user_CM_rev'): try: num_changes = int(changesets['default_CM_rev']) - int...
return CM_url
return None
def get_CM_url(self, trans): CM_url = trans.app.config.get( "CM_url", "http://bitbucket.org/galaxy/cloudman/changesets/" ) changesets = self.app.manager.check_for_new_version_of_CM() if changesets.has_key('default_CM_rev') and changesets.has_key('user_CM_rev'): try: num_changes = int(changesets['default_CM_rev']) - int...
log.info( "Setting up Galaxy" )
log.info( "Setting up Galaxy application" )
def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy...
if os.path.exists('/mnt/galaxyIndices/locfiles/sam_fa_indices.loc'): shutil.copy('/mnt/galaxyIndices/locfiles/sam_fa_indices.loc', '/mnt/galaxyTools/galaxy-central/tool-data/sam_fa_indices.loc')
def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy...
try: misc.run("cd %s; sed 's/pyhton/python -ES/g' setup.sh > setup.sh.custom" % self.galaxy_home, "Failed to edit setup.sh", "Successfully adjusted setup.sh") shutil.copy( self.galaxy_home + '/setup.sh.custom', self.galaxy_home + '/setup.sh' ) os.chown( self.galaxy_home + '/setup.sh', pwd.getpwnam( "galaxy" )[2], grp.g...
def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy...
with open('/etc/profile', 'a') as f: f.write('export PATH=/mnt/galaxyTools/tools/bin:/mnt/galaxyTools/tools/pkg/fastx_toolkit_0.0.13:/mnt/galaxyTools/tools/pkg/bowtie-0.12.5:/mnt/galaxyTools/tools/pkg/samtools-0.1.7_x86_64-linux:/mnt/galaxyTools/tools/pkg/gnuplot-4.4.0/bin:/opt/PostgreSQL/8.4/bin:$PATH\n') os.chown(sel...
def manage_galaxy( self, to_be_started=True ): if self.app.TESTFLAG is True: log.debug( "Attempted to manage Galaxy, but TESTFLAG is set." ) return os.putenv( "GALAXY_HOME", self.galaxy_home ) os.putenv( "TEMP", '/mnt/galaxyData/tmp' ) if to_be_started: self.status() if not self.configured: log.info( "Setting up Galaxy...
'snapshot' : {'progress' : str(self.app.manager.snapshot_progress), 'status' : str(self.app.manager.snapshot_status)},
'snapshot' : {'progress' : str(ss_progress), 'status' : str(ss_status)},
def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d...
import time if time.gmtime().tm_sec < 20 or time.gmtime().tm_sec > 40: ss_status = "Working" ss_progress = (time.gmtime().tm_sec % 20) * 5 else: ss_progress = None ss_status = None
def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d...
'snapshot' : {'progress' : str(ss_progress), 'status' : str(ss_status)},
'snapshot' : {'progress' : str(self.app.manager.snapshot_progress), 'status' : str(self.app.manager.snapshot_status)},
def instance_state_json(self, trans, no_json=False): g_s = self.app.manager.get_services('Galaxy') if g_s and g_s[0].state == service_states.RUNNING: dns = 'http://%s' % str( self.app.cloud_interface.get_self_public_ip() ) else: # dns = '<a href="http://%s" target="_blank">Access Galaxy</a>' % str( 'localhost:8080' ) d...
log.info( "Instance '%s' found alive." % reservation.instances[0].id )
log.info( "Instance '%s' found alive. Restarting instance so it can register with the master." % reservation.instances[0].id ) ec2_conn.reboot_instances([reservation.instances[0].id])
def get_worker_instances( self ): instances = [] if self.app.TESTFLAG is True: # for i in range(5): # instance = Instance( self.app, inst=None, m_state="Pending" ) # instance.id = "WorkerInstance" # instances.append(instance) return instances log.debug("Trying to discover any worker instances associated wit...
<svg width="%s" height="%s" version="1.1" xmlns="http://www.w3.org/2000/svg"
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
def visit_image(self, aa_image, xml_header=True): """Process the given ASCIIArtFigure and output the shapes in the SVG file """ self.aa_image = aa_image #save for later XXX not optimal to do it here self.width = (aa_image.width+1)*aa_image.nominal_size*aa_image.aspect_ratio self.height = (aa_image.height+1)*aa_i...
""" % ( '100%', '100%', ))
""")
def visit_image(self, aa_image, xml_header=True): """Process the given ASCIIArtFigure and output the shapes in the SVG file """ self.aa_image = aa_image #save for later XXX not optimal to do it here self.width = (aa_image.width+1)*aa_image.nominal_size*aa_image.aspect_ratio self.height = (aa_image.height+1)*aa_i...
last_image = self.pythonTemplate % self.imageNumbers[-1]
last_image_name = self.pythonTemplate % self.imageNumbers[-1] if os.path.exists(last_image_name): last_image = last_image_name elif os.path.exists(last_image_name+".gz"): last_image = last_image_name + ".gz" elif os.path.exists(last_image_name+".bz2"): last_image = last_image_name + ".bz2"
def isContinuous(self, imagename_list, methode=0, _epsilon=2e-3): """Return true if the collect is supposed to be a serie of images with consecutive phi angles.""" if not self.imageNumbers: self.lookup_imageNumbers() if not self.image: self.image = Image(self.initialImageName) last_image = self.pythonTemplate % self.im...
new_cell = False
def run_pre_correct(self): """Runs a first pass of CORRECT to evaluate high_res and point group. """ if XDS_INPUT: self.inpParam.mix(xdsInp2Param(inp_str=XDS_INPUT)) # run pointless on INTEGRATE.HKL if not is_pointless_installed(): print "!! Warning. Pointless program doesn't seems to be installed." print " -> Skippi...
lattice = Lattice(new_cell, symmetry=spg_choosen) lattice.idealize()
if new_cell: lattice = Lattice(new_cell, symmetry=spg_choosen) lattice.idealize() self.inpParam["UNIT_CELL_CONSTANTS"] = lattice.cell
def run_pre_correct(self): """Runs a first pass of CORRECT to evaluate high_res and point group. """ if XDS_INPUT: self.inpParam.mix(xdsInp2Param(inp_str=XDS_INPUT)) # run pointless on INTEGRATE.HKL if not is_pointless_installed(): print "!! Warning. Pointless program doesn't seems to be installed." print " -> Skippi...
self.inpParam["UNIT_CELL_CONSTANTS"] = lattice.cell
def run_pre_correct(self): """Runs a first pass of CORRECT to evaluate high_res and point group. """ if XDS_INPUT: self.inpParam.mix(xdsInp2Param(inp_str=XDS_INPUT)) # run pointless on INTEGRATE.HKL if not is_pointless_installed(): print "!! Warning. Pointless program doesn't seems to be installed." print " -> Skippi...
return reciprocal(UB_to_cellParam(UB*REIDX))
return reciprocal(UB_to_cellParam(REIDX*UB))
def new_reidx_cell(init_cell, reidx_mat): "Applies the reindexing card to initial cell parameters and return a new cell" UB = BusingLevy(reciprocal(init_cell)) REIDX = mat3(reidx_mat) return reciprocal(UB_to_cellParam(UB*REIDX))
def if_platform_tagged(platform, tag, closure, c2=None):
def if_platform_tagged(platform, tag, snippet_if, snippet_else=None):
def if_platform_tagged(platform, tag, closure, c2=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + closure() r += "[+ ESAC +][+ ENDFOR +]" if c2 == None: r += "[+ ENDIF +]" return r r += "[+ ELSE +]" + ...
r += "[+ = \"" + group + "\" +]" + closure()
r += "[+ = \"" + group + "\" +]" + snippet_if if snippet_else != None: r += "[+ * +]" + snippet_if
def if_platform_tagged(platform, tag, closure, c2=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + closure() r += "[+ ESAC +][+ ENDFOR +]" if c2 == None: r += "[+ ENDIF +]" return r r += "[+ ELSE +]" + ...
if c2 == None:
if snippet_else == None:
def if_platform_tagged(platform, tag, closure, c2=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + closure() r += "[+ ESAC +][+ ENDFOR +]" if c2 == None: r += "[+ ENDIF +]" return r r += "[+ ELSE +]" + ...
r += "[+ ELSE +]" + c2() + "[+ ENDIF +]" return r def platform_values(platform, group_tag, default_tag):
r += "[+ ELSE +]" + snippet_else + "[+ ENDIF +]" return r def foreach_platform_value(platform, tag, suffix, closure):
def if_platform_tagged(platform, tag, closure, c2=None): r = "" r += "[+ IF " + tag + " defined +]" r += "[+ FOR " + tag + " +][+ CASE " + tag + " +]" for group in RMAP[platform]: r += "[+ = \"" + group + "\" +]" + closure() r += "[+ ESAC +][+ ENDFOR +]" if c2 == None: r += "[+ ENDIF +]" return r r += "[+ ELSE +]" + ...
gtag = group + group_tag
gtag = group + suffix
def platform_values(platform, group_tag, default_tag): r = "" for group in RMAP[platform]: gtag = group + group_tag if group == RMAP[platform][0]: r += "[+ IF " + gtag + " +]" else: r += "[+ ELIF " + gtag + " +]" r += "[+ FOR " + gtag + " +][+ ." + gtag + " +] [+ ENDFOR +]" r += "[+ ELSE +][+ FOR " + default_tag + " ...
r += "[+ FOR " + gtag + " +][+ ." + gtag + " +] [+ ENDFOR +]" r += "[+ ELSE +][+ FOR " + default_tag + " +][+ ." + default_tag + " +] [+ ENDFOR +][+ ENDIF +]" return r def under_conditional(x): return "[+ IF condition +]\nif [+ condition +]\n[+ ENDIF +]" + x + "[+ IF condition +]\nendif\n[+ ENDIF +]"
r += "[+ FOR " + gtag + " +]" + closure("[+ ." + gtag + " +]") + "[+ ENDFOR +]" r += "[+ ELSE +][+ FOR " + tag + " +]" + closure("[+ ." + tag + " +]") + "[+ ENDFOR +][+ ENDIF +]" return r
def platform_values(platform, group_tag, default_tag): r = "" for group in RMAP[platform]: gtag = group + group_tag if group == RMAP[platform][0]: r += "[+ IF " + gtag + " +]" else: r += "[+ ELIF " + gtag + " +]" r += "[+ FOR " + gtag + " +][+ ." + gtag + " +] [+ ENDFOR +]" r += "[+ ELSE +][+ FOR " + default_tag + " ...