rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
extentlist.sort(self.sortMe)
extentlist.sort(self.sortMe) for k in range(0, len(extentlist) -1): current = extentlist[k] next = extentlist[k+1] st,sz = current.get_start_size() st_next,sz_next = next.get_start_size() if (st + sz) == st_next: name = current.get_name() name_next = next.get_name() if name == name_next: if current.get_annotation...
def get_extents_for_PV(self, pv ): extentlist = list() pathname = pv.get_path().strip() #Cases: ##1) vgname == "", add one extent 'free' using all extents ##2) query_LVs_for_VG returns empty list, same as 1 ##3) extents are used, build list and fill in free holes
self.command_handler.unmount_lv(self.lv.get_path())
self.command_handler.unmount_lv(lv_path)
def apply(self): name_new = self.name_entry.get_text().strip() size_new = int(self.size_new) # in extents iter = self.filesys_combo.get_active_iter() filesys_new = self.filesystems[self.filesys_combo.get_model().get_value(iter, 0)] if filesys_new.mountable: mount_new = self.glade_xml.get_widget('mount').get_active() ...
self.fs.extend_offline(lv_path)
if self.fs.extendable_offline: self.fs.extend_offline(lv_path) else: tmp_mountpoint = '/tmp/tmp_mountpoint' while os.access(tmp_mountpoint, os.F_OK): tmp_mountpoint = tmp_mountpoint + '1' os.mkdir(tmp_mountpoint) self.command_handler.mount(lv_path, tmp_mountpoint) self.fs.extend_online(lv_path) self.command_handler.un...
def apply(self): name_new = self.name_entry.get_text().strip() size_new = int(self.size_new) # in extents iter = self.filesys_combo.get_active_iter() filesys_new = self.filesystems[self.filesys_combo.get_model().get_value(iter, 0)] if filesys_new.mountable: mount_new = self.glade_xml.get_widget('mount').get_active() ...
self.fs.reduce_offline(lv_path, new_size_bytes)
if self.fs.reducible_offline: self.fs.reduce_offline(lv_path, new_size_bytes) else: tmp_mountpoint = '/tmp/tmp_mountpoint' while os.access(tmp_mountpoint, os.F_OK): tmp_mountpoint = tmp_mountpoint + '1' os.mkdir(tmp_mountpoint) self.command_handler.mount(lv_path, tmp_mountpoint) self.fs.reduce_online(lv_path, new_size...
def apply(self): name_new = self.name_entry.get_text().strip() size_new = int(self.size_new) # in extents iter = self.filesys_combo.get_active_iter() filesys_new = self.filesystems[self.filesys_combo.get_model().get_value(iter, 0)] if filesys_new.mountable: mount_new = self.glade_xml.get_widget('mount').get_active() ...
st,sz = extentlist[len(extentlist) - 1].get_start_size()
def get_extents_for_PV(self, pv ): extentlist = list() pathname = pv.get_path().strip() #Cases: ##1) vgname == "", add one extent 'free' using all extents ##2) query_LVs_for_VG returns empty list, same as 1 ##3) extents are used, build list and fill in free holes
if (st + sz) != total: new_start = st + sz new_size = total - new_start ex = ExtentSegment(FREE, new_start, new_size, FALSE)
if total == free: ex = ExtentSegment(FREE, 0, free, FALSE)
def get_extents_for_PV(self, pv ): extentlist = list() pathname = pv.get_path().strip() #Cases: ##1) vgname == "", add one extent 'free' using all extents ##2) query_LVs_for_VG returns empty list, same as 1 ##3) extents are used, build list and fill in free holes
def get_extent_data_for_PV(self, pathname): arglist = list() arglist.append("/usr/sbin/lvm") arglist.append("pvs") arglist.append("--noheadings") arglist.append("--separator") arglist.append(",") arglist.append("-o") arglist.append("pv_pe_count,pv_pe_alloc_count") arglist.append("pathname") result_string = rhpl.execut...
def get_extent_data_for_PV(self, pathname): arglist = list() arglist.append("/usr/sbin/lvm") arglist.append("pvs") arglist.append("--noheadings") arglist.append("--separator") arglist.append(",") arglist.append("-o") arglist.append("pv_pe_count,pv_pe_alloc_count") arglist.append("pathname") result_string = rhpl.execut...
if vgname != vg.get_name(): return False
if vgname == vg.get_name(): self.treeview.expand_to_path(path) selection.select_path(path) return True
def check_tree_items(self, model, path, iter, *args): # return True to stop foreach, False to continue if len(args) == 0: return True # don't go any further args_internal = [] for arg in args[0]: args_internal.append(arg) while len(args_internal) < 3: args_internal.append('') vgname = args_internal[0] lvpath = args_in...
if lvpath != lv.get_path(): return False
if lvpath == lv.get_path(): self.treeview.expand_to_path(path) selection.select_path(path) return True
def check_tree_items(self, model, path, iter, *args): # return True to stop foreach, False to continue if len(args) == 0: return True # don't go any further args_internal = [] for arg in args[0]: args_internal.append(arg) while len(args_internal) < 3: args_internal.append('') vgname = args_internal[0] lvpath = args_in...
if pvpath not in pv.get_paths(): return False else: return False self.treeview.expand_to_path(path) selection.select_path(path) return True
if pvpath in pv.get_paths(): self.treeview.expand_to_path(path) selection.select_path(path) return True return False
def check_tree_items(self, model, path, iter, *args): # return True to stop foreach, False to continue if len(args) == 0: return True # don't go any further args_internal = [] for arg in args[0]: args_internal.append(arg) while len(args_internal) < 3: args_internal.append('') vgname = args_internal[0] lvpath = args_in...
extend_online = self.check_path('/usr/sbin/ext2online')
extend_online, dummy = self.__extend_online_cmd()
def __init__(self): creatable = self.check_path('/sbin/mkfs.ext3') mountable = self.check_mountable('ext3', 'ext3') resize_offline = self.check_paths(['/sbin/e2fsck', '/sbin/resize2fs']) extend_online = self.check_path('/usr/sbin/ext2online') Filesystem.__init__(self, 'Ext3', creatable, True, mountable, extend_online,...
args = list() args.append('/usr/sbin/ext2online') args.append(dev_path)
dummy, cmd = self.__extend_online_cmd() args = [cmd, dev_path]
def extend_online(self, dev_path): args = list() args.append('/usr/sbin/ext2online') args.append(dev_path) cmdstr = ' '.join(args) msg = RESIZING_FS % (self.name) o,e,r = execWithCaptureErrorStatusProgress('/usr/sbin/ext2online', args, msg) if r != 0: raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr,e))
o,e,r = execWithCaptureErrorStatusProgress('/usr/sbin/ext2online', args, msg) if r != 0: raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr,e))
o, e, s = execWithCaptureErrorStatusProgress(cmd, args, msg) if s != 0: raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr, e)) def __extend_online_cmd(self): cmd = '/usr/sbin/ext2online' if self.check_path(cmd): return (True, cmd) try: cmd = '/sbin/resize2fs' o, e, s = execWithCaptureErrorStatus(cmd, [cmd]) if (...
def extend_online(self, dev_path): args = list() args.append('/usr/sbin/ext2online') args.append(dev_path) cmdstr = ' '.join(args) msg = RESIZING_FS % (self.name) o,e,r = execWithCaptureErrorStatusProgress('/usr/sbin/ext2online', args, msg) if r != 0: raise CommandError('FATAL', FSRESIZE_FAILURE % (cmdstr,e))
d = {} d['/dev/test_multipath'] = ['/dev/hda', '/dev/hde'] return d def get_multipath_data_2(self):
def get_multipath_data(self): #return self.get_multipath_data() # for testing purposes, return arbitrary values d = {} d['/dev/test_multipath'] = ['/dev/hda', '/dev/hde'] #, '/dev/hdb', '/dev/hdm'] #d['/dev/mapper/testmultipath_2'] = ['/dev/sda', '/dev/sdb'] return d
selection.select_range(path, path)
selection.select_path(path)
def check_tree_items(self, model, path, iter, *args): name_selection_argss = list() for a in args: name_selection_argss.append(a) if self.found_selection == TRUE: return
res = execWithCapture(PARTED, [PARTED, devpath, 'print', '-s'])
res, status = execWithCaptureStatus(PARTED, [PARTED, devpath, 'unit', 'b', 'print', '-s']) if status != 0: res, status = execWithCaptureStatus(PARTED, [PARTED, devpath, 'print', '-s'])
def getPartitions(self, devpath): sectorSize = FDisk().getDeviceGeometry(devpath)[1] parts = list() res = execWithCapture(PARTED, [PARTED, devpath, 'print', '-s']) lines = res.splitlines() for line in lines: if not re.match('^[0-9]', line): continue words = line.split() if len(words) < 3: continue # partition num part_...
if self.new: self.on_mirrored_changed(None) else: self.on_enable_mirroring(None)
self.on_enable_mirroring(None)
def on_fs_change(self, obj): self.filesys_show_hide() if self.new: self.on_mirrored_changed(None) else: self.on_enable_mirroring(None)
self.lv_combo.set_active(False)
self.lv_combo.set_sensitive(False)
def __init__(self, migrate, pvs, lvs): gladepath = 'migrate_extents.glade' if not os.path.exists(gladepath): gladepath = "%s/%s" % (INSTALLDIR, gladepath) gtk.glade.bindtextdomain(PROGNAME) self.glade_xml = gtk.glade.XML (gladepath, domain=PROGNAME) # fill out lv selection combobox self.lv_combo = gtk.combo_box_new_te...
self.pv_combo.set_active(False)
self.pv_combo.set_sensitive(False)
def __init__(self, migrate, pvs, lvs): gladepath = 'migrate_extents.glade' if not os.path.exists(gladepath): gladepath = "%s/%s" % (INSTALLDIR, gladepath) gtk.glade.bindtextdomain(PROGNAME) self.glade_xml = gtk.glade.XML (gladepath, domain=PROGNAME) # fill out lv selection combobox self.lv_combo = gtk.combo_box_new_te...
self.pv_combo.set_active(True) else: self.pv_combo.set_active(False)
self.pv_combo.set_sensitive(True) else: self.pv_combo.set_sensitive(False)
def on_choose_pv_radio(self, obj1): if self.glade_xml.get_widget('choose_pv_radio').get_active(): self.pv_combo.set_active(True) else: self.pv_combo.set_active(False)
self.lv_combo.set_active(True) else: self.lv_combo.set_active(False)
self.lv_combo.set_sensitive(True) else: self.lv_combo.set_sensitive(False)
def on_choose_lv_check(self, obj1): if self.glade_xml.get_widget('choose_lv_check').get_active(): self.lv_combo.set_active(True) else: self.lv_combo.set_active(False)
if max_mirror_size != 0: if self.size_new > max_mirror_size: if self.new: self.infoMessage('fixme: size changed to fit') else: self.errorMessage('fixme: not enough room for mirroring. Reduce size of LV to at most ' + str(self.__get_num(max_mirror_size)) + ', or add some PVs') self.glade_xml.get_widget('enable_mirroring...
if max_mirror_size == 0:
def on_enable_mirroring(self, obj): if self.glade_xml.get_widget('enable_mirroring').get_active() == False: self.update_size_limits() return # check if lv is striped - no mirroring if not self.new: for seg in self.lv.get_segments(): if seg.get_type() == STRIPED_SEGMENT_ID: self.errorMessage('fixme: Striped LVs cannot b...
return 0
return 0, [], []
def __get_max_mirror_data(self): # copy pvs into dir free_list = [] for pv in self.vg.get_pvs().values(): free_extents = pv.get_extent_total_used_free()[2] # add extents of current LV if not self.new: if self.lv.is_mirrored(): lvs_to_match = self.lv.get_segments()[0].get_images() else: lvs_to_match = [self.lv] for ext ...
header_layout = pango.Layout(pc)
def prepare_header_layout(self, name, type): pc = self.pango_context desc = pc.get_font_description() desc.set_size(BIG_HEADER_SIZE) pc.set_font_description(desc) header_layout = pango.Layout(pc)
attr,text,a = pango.parse_markup(layout_string, u'_') header_layout.set_attributes(attr) header_layout.set_text(text)
header_layout = self.area.create_pango_layout('') header_layout.set_markup(layout_string)
def prepare_header_layout(self, name, type): pc = self.pango_context desc = pc.get_font_description() desc.set_size(BIG_HEADER_SIZE) pc.set_font_description(desc) header_layout = pango.Layout(pc)
prop_layout = pango.Layout(pc)
def prepare_prop_layout(self, prop_list,type): pc = self.pango_context desc = pc.get_font_description() desc.set_size(PROPERTY_SIZE) pc.set_font_description(desc) prop_layout = pango.Layout(pc) text_str = self.prepare_props_list(prop_list, type) props_layout = pango.Layout(self.pango_context) attr,text,a = pango.pars...
props_layout = pango.Layout(self.pango_context) attr,text,a = pango.parse_markup(text_str, u'_') props_layout.set_attributes(attr) props_layout.set_text(text)
props_layout = self.area.create_pango_layout('') props_layout.set_markup(text_str)
def prepare_prop_layout(self, prop_list,type): pc = self.pango_context desc = pc.get_font_description() desc.set_size(PROPERTY_SIZE) pc.set_font_description(desc) prop_layout = pango.Layout(pc) text_str = self.prepare_props_list(prop_list, type) props_layout = pango.Layout(self.pango_context) attr,text,a = pango.pars...
elif (rc == gtk.RESPONSE_DELETE_EVENT): return elif (rc == gtk.RESPONSE_CLOSE): return
def on_pv_rm(self, button): selection = self.treeview.get_selection() model, iter = selection.get_selected() name = model.get_value(iter, PATH_COL) pvname = name.strip() pv = self.model_factory.get_PV(pvname) vgname = pv.get_vg_name().strip() total,free,alloc = pv.get_extent_values() retval = self.warningMessage(CONFIR...
return elif (rc == gtk.RESPONSE_DELETE_EVENT): return elif (rc == gtk.RESPONSE_CLOSE):
def on_lv_rm(self, button): selection = self.treeview.get_selection() model, iter = selection.get_selected() name = model.get_value(iter, PATH_COL) lvname = name.strip() retval = self.warningMessage(CONFIRM_LV_REMOVE % lvname) if (retval == gtk.RESPONSE_NO): return elif (rc == gtk.RESPONSE_DELETE_EVENT): return elif (r...
elif (rc == gtk.RESPONSE_DELETE_EVENT): continue elif (rc == gtk.RESPONSE_CLOSE): continue
def on_rm_select_lvs(self, button): if self.section_list == None: return #check if list > 0 if len(self.section_list) == 0: return #need to check if section is 'unused' for item in self.section_list: if item.is_vol_utilized == FALSE: continue lvname = item.get_name().strip() retval = self.warningMessage(CONFIRM_LV_REMO...
elif (rc == gtk.RESPONSE_DELETE_EVENT): continue elif (rc == gtk.RESPONSE_CLOSE): continue
def on_rm_select_pvs(self, button): if self.section_list == None: return #need tto check if list > 0 if len(self.section_list) == 0: return selection = self.treeview.get_selection() model,iter = selection.get_selected() vgname = model.get_value(iter, PATH_COL).strip() #need to check if section is 'unused' for item in s...
if (rc == gtk.RESPONSE_DELETE_EVENT): return if (rc == gtk.RESPONSE_CLOSE): return
def on_init_entity(self, button): selection = self.treeview.get_selection() model,iter = selection.get_selected() name = model.get_value(iter, PATH_COL) #message = INIT_ENTITY_1 + name + INIT_ENTITY_2 message = INIT_ENTITY % name rc = self.warningMessage(message) if (rc == gtk.RESPONSE_NO): return if (rc == gtk.RESPONS...
elif (rc == gtk.RESPONSE_DELETE_EVENT): return elif (rc == gtk.RESPONSE_CLOSE): return
def on_remove_unalloc_pv(self, button): selection = self.treeview.get_selection() model, iter = selection.get_selected() name = model.get_value(iter, PATH_COL) pvname = name.strip() retval = self.warningMessage(CONFIRM_PVREMOVE % pvname) if (retval == gtk.RESPONSE_NO): return elif (rc == gtk.RESPONSE_DELETE_EVENT): ret...
lmctools.shLaunch("net groupmap add unixgroup=%s" % group)
lmctools.shLaunch("net groupmap add unixgroup='%s'" % group)
def makeSambaGroup(self, group): """ Transform a POSIX group as a SAMBA group. It adds in the LDAP the necessary attributes to the group.
self.InsertImageStringItem(imID, item[0], imID)
self.InsertImageStringItem(imID, item[0], item[1])
def Update(self, show=None): imID = 0 self.DeleteAllItems() for item in self.items: if (show=="pub" and item[2]=="pub") or (show=="all"): self.InsertImageStringItem(imID, item[0], imID) self.SetItemData(imID, item[1]) imID = imID + 1
cls = self.cat_list.GetSelection() uls = self.upl_list.GetSelection()
try: cls = self.cat_list.GetSelection() uls = self.upl_list.GetSelection() except: cls = None uls = None
def complete(self, x): if self.dirCtl.GetValue() == '': dlg = wx.MessageDialog(self, message = _("You didn't choose any file or directory."), caption = _('Error'), style = wx.OK | wx.ICON_ERROR) dlg.ShowModal() dlg.Destroy() return try: ps = 21 - self.piece_length.GetSelection() files = self.dirCtl.GetValue().split(';'...
beg, end, inc = e.indices(shape[n])
if unlim and e.stop > shape[n]: beg, end, inc = e.indices(e.stop) else: beg, end, inc = e.indices(shape[n])
def _buildStartCountStride(elem, shape, dimensions, grp): # Create the 'start', 'count', 'slice' and 'stride' tuples that # will be passed to 'nc_get_var_0'/'nc_put_var_0'. # start starting indices along each dimension # count count of values along each dimension; a value of -1 # indicates that...
options = [option for (section, _), option in Option.registry.iteritems() if section == page] options.sort(key=lambda a: a.name)
options = sorted([option for (section, _), option in Option.registry.iteritems() if section == page], key=lambda a: a.name)
def process_admin_request(self, req, cat, page, path_info): assert req.perm.has_permission('TRAC_ADMIN') if page not in set([s for s, _ in Option.registry]): raise TracError("Invalid section %s" % page)
else: assert isinstance(other, Vector2)
elif isinstance(other, Point2): P = Point2(0, 0) P.x = A.a * B.x + A.b * B.y + A.c P.y = A.e * B.x + A.f * B.y + A.g return P elif isinstance(other, Vector2):
def __mul__(self, other): A = self B = other if isinstance(other, Matrix3): C = Matrix3() C.a = A.a * B.a + A.b * B.e + A.c * B.i C.b = A.a * B.b + A.b * B.f + A.c * B.j C.c = A.a * B.c + A.b * B.g + A.c * B.k C.e = A.e * B.a + A.f * B.e + A.g * B.i C.f = A.e * B.b + A.f * B.f + A.g * B.j C.g = A.e * B.c + A.f * B.g + ...
V.x = A.a * B.x + A.b * B.y + A.c V.y = A.e * B.x + A.f * B.y + A.g
V.x = A.a * B.x + A.b * B.y V.y = A.e * B.x + A.f * B.y
def __mul__(self, other): A = self B = other if isinstance(other, Matrix3): C = Matrix3() C.a = A.a * B.a + A.b * B.e + A.c * B.i C.b = A.a * B.b + A.b * B.f + A.c * B.j C.c = A.a * B.c + A.b * B.g + A.c * B.k C.e = A.e * B.a + A.f * B.e + A.g * B.i C.f = A.e * B.b + A.f * B.f + A.g * B.j C.g = A.e * B.c + A.f * B.g + ...
else: assert isinstance(other, Vector3)
elif isinstance(other, Point3): P = Point3(0, 0, 0) P.x = A.a * B.x + A.b * B.y + A.c * B.z + A.d P.y = A.e * B.x + A.f * B.y + A.g * B.z + A.h P.z = A.i * B.x + A.j * B.y + A.k * B.z + A.l return P elif isinstance(other, Vector3):
def __mul__(self, other): A = self B = other if isinstance(other, Matrix4): C = Matrix4() C.a = A.a * B.a + A.b * B.e + A.c * B.i + A.d * B.m C.b = A.a * B.b + A.b * B.f + A.c * B.j + A.d * B.n C.c = A.a * B.c + A.b * B.g + A.c * B.k + A.d * B.o C.d = A.a * B.d + A.b * B.h + A.c * B.l + A.d * B.p C.e = A.e * B.a + A.f ...
V.x = A.a * B.x + A.b * B.y + A.c * B.z + A.d V.y = A.e * B.x + A.f * B.y + A.g * B.z + A.h V.z = A.i * B.x + A.j * B.y + A.k * B.z + A.l
V.x = A.a * B.x + A.b * B.y + A.c * B.z V.y = A.e * B.x + A.f * B.y + A.g * B.z V.z = A.i * B.x + A.j * B.y + A.k * B.z
def __mul__(self, other): A = self B = other if isinstance(other, Matrix4): C = Matrix4() C.a = A.a * B.a + A.b * B.e + A.c * B.i + A.d * B.m C.b = A.a * B.b + A.b * B.f + A.c * B.j + A.d * B.n C.c = A.a * B.c + A.b * B.g + A.c * B.k + A.d * B.o C.d = A.a * B.d + A.b * B.h + A.c * B.l + A.d * B.p C.e = A.e * B.a + A.f ...
else: assert isinstance(other, Vector3)
elif isinstance(other, Vector3):
def __mul__(self, other): if isinstance(other, Quaternion): A = self B = other Q = Quaternion() Q.x = A.x * B.w + A.y * B.z - A.z * B.y + A.w * B.x Q.y = -A.x * B.z + A.y * B.w + A.z * B.x + A.w * B.y Q.z = A.x * B.y - A.y * B.x + A.z * B.w + A.w * B.z Q.w = -A.x * B.x - A.y * B.y - A.z * B.z + A.w * B.w return Q els...
p2 = property(lambda self: Point2(self.p.x + self.v.x, self.p.y + self.v.y))
p2 = property(lambda self: Point2(self.p.x + self.v.x, self.p.y + self.v.y)) def _apply_transform(self, t): self.p = t * self.p self.v = t * self.v
def __repr__(self): return 'Line2(<%.2f, %.2f> + u<%.2f, %.2f>)' % \ (self.p.x, self.p.y, self.v.x, self.v.y)
return type.__new__(cls, name, (object,), dct)
return type.__new__(cls, name, bases + (object,), dct)
def __new__(cls, name, bases, dct): if _use_slots: return type.__new__(cls, name, (object,), dct) else: del dct['__slots__'] return types.ClassType.__new__(types.ClassType, name, (), dct)
return types.ClassType.__new__(types.ClassType, name, (), dct)
return types.ClassType.__new__(types.ClassType, name, bases, dct)
def __new__(cls, name, bases, dct): if _use_slots: return type.__new__(cls, name, (object,), dct) else: del dct['__slots__'] return types.ClassType.__new__(types.ClassType, name, (), dct)
if self.current == None: self.current = user if self.mucous.mode == "private":
if self.mucous.mode == "private": if self.current == None: self.current = user
def Recieved(self,direction, timestamp, user, message): try: ctcpversion = 0 if message == curses.ascii.ctrl("A")+"VERSION"+curses.ascii.ctrl("A"): message = "CTCP VERSION" ctcpversion = 1 if user not in self.logs.keys(): self.logs[user] = [] if self.mucous.Config["mucous"]["logging"] in ("yes"): self.ImportLogs(user...
elif self.current == user: if self.mucous.mode == "private":
elif self.current == user:
def Recieved(self,direction, timestamp, user, message): try: ctcpversion = 0 if message == curses.ascii.ctrl("A")+"VERSION"+curses.ascii.ctrl("A"): message = "CTCP VERSION" ctcpversion = 1 if user not in self.logs.keys(): self.logs[user] = [] if self.mucous.Config["mucous"]["logging"] in ("yes"): self.ImportLogs(user...
longstring += "[%s] %s " % (user, ticks[user])
longstring += "[%s] %s " % (user, self.mucous.dlang(ticks[user]))
def DrawTicker(self): try: if self.mucous.mode != "chat" or self.current not in self.tickers or self.mucous.Config["tickers"]["tickers_enabled"] != 'yes': return ticks = self.tickers[self.current] ttickers = ticks.keys() if ttickers == []: self.ticker_timer.cancel() try: self.DrawStatusWin() self.DrawStatusText() curse...
bw.addstr(posy, posx, "<%s%s>" %(part, fill))
message = "" for m in part: message += curses.unctrl(m) bw.addstr(posy, posx, "<%s%s>" %(message, fill))
def DrawTicker(self): try: if self.mucous.mode != "chat" or self.current not in self.tickers or self.mucous.Config["tickers"]["tickers_enabled"] != 'yes': return ticks = self.tickers[self.current] ttickers = ticks.keys() if ttickers == []: self.ticker_timer.cancel() try: self.DrawStatusWin() self.DrawStatusText() curse...
self.mucous.Help.Log("debug", "DrawTicker: " + str(e))
self.mucous.Help.Log("debug", "ChatRooms.DrawTicker: " + str(e))
def DrawTicker(self): try: if self.mucous.mode != "chat" or self.current not in self.tickers or self.mucous.Config["tickers"]["tickers_enabled"] != 'yes': return ticks = self.tickers[self.current] ttickers = ticks.keys() if ttickers == []: self.ticker_timer.cancel() try: self.DrawStatusWin() self.DrawStatusText() curse...
self.mucous.ScrollText()
self.mucous.ScrollText("KEY_NPAGE")
def MouseChat(self, x, y, z, event): try: w = self.dimensions["chat"] if y == w["top"]-1 and x >= w["left"]-1 and x < w["left"]+3: self.ChatLayout() return # Clickable room switch if "roombox" in self.dimensions and self.shape not in ( "noroombox", "chat-only"): roombox = self.dimensions["roombox"] if y >= roombox["to...
self.mucous.ScrollText()
self.mucous.ScrollText("KEY_PPAGE")
def MouseChat(self, x, y, z, event): try: w = self.dimensions["chat"] if y == w["top"]-1 and x >= w["left"]-1 and x < w["left"]+3: self.ChatLayout() return # Clickable room switch if "roombox" in self.dimensions and self.shape not in ( "noroombox", "chat-only"): roombox = self.dimensions["roombox"] if y >= roombox["to...
term = self while not term.isEmpty(): yield term.head term = term.tail raise StopIteration
raise NotImplementedError
def __iter__(self): term = self while not term.isEmpty(): yield term.head term = term.tail raise StopIteration
return antlr.dup(t,self)
return dup(t,self)
def dup(self,t): return antlr.dup(t,self)
return antlr.dupList(t,self)
return dupList(t,self)
def dupList(self,t): return antlr.dupList(t,self)
return antlr.dupTree(t,self)
return dupTree(t,self)
def dupTree(self,t): return antlr.dupTree(t,self)
return self.extend(self.factory.makeConst(element, self.factory.makeNil()))
return self.extend(self.factory.makeCons(element, self.factory.makeNil()))
def append(self, element): return self.extend(self.factory.makeConst(element, self.factory.makeNil()))
self.tail.append(tail),
self.tail.extend(tail),
def extend(self, tail): return self.factory.makeCons( self.head, self.tail.append(tail), self.annotations )
rc_template = """ %(CHKCONFIG)s
rootcheck = """
def update(self): pass
start|status) %(CTL_SCRIPT)s ;;
def update(self): pass
echo "Usage: ${0} [ start | stop | status | restart ]" exit 1
%(CTL_SCRIPT)s
def update(self): pass
c.ctcp_reply(nm_to_n(e.source()), self.get_version())
c.ctcp_reply(nm_to_n(e.source()), "VERSION " + self.get_version())
def on_ctcp(self, c, e): """Default handler for ctcp events.
self.send_raw("ISON " + string.join(nicks, ","))
self.send_raw("ISON " + string.join(nicks, " "))
def ison(self, nicks): """Send an ISON command.
def whowas(self, nick, max=None, server=""):
def whowas(self, nick, max="", server=""):
def whowas(self, nick, max=None, server=""): """Send a WHOWAS command.""" self.send_raw("WHOWAS %s%s%s" % (nick, max and (" " + max), server and (" " + server)))
elif e.arguments()[0] == "DCC" and e.arguments()[1] = "CHAT":
elif e.arguments()[0] == "DCC" and e.arguments()[1] == "CHAT":
def on_ctcp(self, c, e): """Default handler for ctcp events.
arguments = arguments[0]
arguments = [arguments[0]]
def process_data(self): """[Internal]"""
self.connected = 0
def disconnect(self, message=""): """Hang up the connection.
elif e.arguments()[0] == "DCC" and e.arguments()[1] == "CHAT":
elif e.arguments()[0] == "DCC" and string.split(e.arguments()[1], " ", 1)[0] == "CHAT":
def on_ctcp(self, c, e): """Default handler for ctcp events.
"""Connect to a new server, possible disconnecting from the current.
"""Connect to a new server, possibly disconnecting from the current.
def jump_server(self): """Connect to a new server, possible disconnecting from the current.
"python:portal.portal_membership.getAuthenticatedMember().has_role('Member')",
"python:portal.portal_membership.getAuthenticatedMember().has_role('Employee')",
def configureUserActions(portal): # add an action to the persnal bar for project management actionTool = getToolByName(portal, 'portal_membership', None) actionTool_actions = actionTool._cloneActions() actionDefined=0 for a in actionTool_actions: if a.id in ['time_registration',]: a.visible = 1 actionDefined = 1 action...
print >> out, "Customize the portal" setupSkin(self)
def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) out.write("Successfully installed %s." % PROJECTNAME) print >> out, "Customize the portal" setupSkin(self) print >> out, "Configuring new roles" configureRoles(self) print >> out, "C...
sdef.setPermission('Access contents information', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('Access contents information', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['in-progress']
sdef.setPermission('View', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('View', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['in-progress']
sdef.setPermission('Access contents information', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('Access contents information', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['completed']
sdef.setPermission('View', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('View', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['completed']
sdef.setPermission('Access contents information', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('Access contents information', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['open']
sdef.setPermission('View', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('View', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['open']
getBookingDate={ "query": [date, date+1], "range": "minmax"},
getBookingDate={ "query": [date, date+0.9999], "range": "minmax"},
def getPrevYearMonth(year, month): # Get the year and month for the previous month (watch out for January) prevmonth = month - 1 prevyear = year if prevmonth == 0: prevyear = year - 1 prevmonth = 12 return (prevyear, prevmonth)
mailMessage(portal, self, 'New Task assigned')
self.log.warn('Not sending email to %s for task %s.', value, self.id)
def setAssignees(self, value, **kw): """ Overwrite the default setter. An email should be sent on assignment. """ old_assignees = self.getAssignees() if old_assignees != value: self.schema['assignees'].set(self, value) portal = getToolByName(self, 'portal_url').getPortalObject() mailMessage(portal, self, 'New Task ass...
setup_tool.setImportContext('profile-eXtremeManagement:default'
setup_tool.setImportContext('profile-eXtremeManagement:default')
def applyGenericSetupProfile(portal, out): setup_tool = getToolByName(portal, 'portal_setup') setup_tool.setImportContext('profile-eXtremeManagement:default' print >> out, "Applied the generic setup profile for eXtremeManagement" setup_tool.runAllImportSteps(purge_old=False) setup_tool.setImportContext('profile-CMFPlon...
hours = float(self.getHours()) minutes = float(self.getMinutes())/60
try: hours = float(self.getHours()) except: hours = 0.0 try: minutes = float(self.getMinutes())/60 except: minutes = 0.0
def getRawActualHours(self): """ Get the total hours and minutes in decimal format for further calculations. """ hours = float(self.getHours()) minutes = float(self.getMinutes())/60 return hours + minutes
estimated = self.getRoughEstimate() * HOURS_PER_DAY
try: estimated = self.getRoughEstimate() * HOURS_PER_DAY except: estimated = 0
def getRawEstimate(self): """ When a story has tasks, get their estimates. If not, get the roughEstimate of this story. HOURS_PER_DAY is set in AppConfig.py (probably 8). """ tasks = self.contentValues() estimated = 0.0 estimates = [] if tasks: for task in tasks: estimates.append(task.getRawEstimate()) estimated = sum(...
return round(actual/estimated*100, 1)
if estimated > 0: return round(actual/estimated*100, 1) else: return 0.0
def get_progress_perc(self): """ """ tasks = self.contentValues() estimates = [] actual = 0.0 if tasks: for task in tasks: estimates.append(task.getEstimate()) actual = actual + task.get_actual_hours() estimated = sum(estimates) return round(actual/estimated*100, 1) else: return 0
for userid in portal.acl_users.getUserIds(): if 'Employee' in portal.acl_users.getUserById(userid).getRoles() or userid in members:
users = {} current = portal.aq_inner while current is not None: if hasattr(current, 'aq_base') and hasattr(current.aq_base, 'acl_users'): for user in current.acl_users.getUsers(): userid = user.getId() roles = users.get(userid, None) if roles is None: roles = Set() users[userid] = roles roles.update(user.getRoles()) cu...
def _get_assignees(self): """ returns a list of team members """ portal = getToolByName(self, 'portal_url').getPortalObject() mem = getToolByName(self, 'portal_membership') uids = [] members = self.getProject().getMembers()
name = hasattr(member, 'fullname') and member.fullname.strip() or member.getId() uids.append((userid, name))
if member is not None: name = hasattr(member, 'fullname') and member.fullname.strip() or member.getId() uids.append((userid, name))
def _get_assignees(self): """ returns a list of team members """ portal = getToolByName(self, 'portal_url').getPortalObject() mem = getToolByName(self, 'portal_membership') uids = [] members = self.getProject().getMembers()
for s in ['in-progress', 'completed', 'open']:
for s in ['in-progress', 'activated', 'completed', 'open']:
def setupExtreme_iteration_workflow(wf): "..." wf.setProperties(title='eXtreme Iteration Workflow') for s in ['in-progress', 'completed', 'open']: wf.states.addState(s) for t in ['activate', 'complete', 'retract']: wf.transitions.addTransition(t) for v in ['action', 'review_history', 'actor', 'comments', 'time']: wf.v...
for t in ['activate', 'complete', 'retract']:
for t in ['retract', 'activate', 'complete', 'accept']:
def setupExtreme_iteration_workflow(wf): "..." wf.setProperties(title='eXtreme Iteration Workflow') for s in ['in-progress', 'completed', 'open']: wf.states.addState(s) for t in ['activate', 'complete', 'retract']: wf.transitions.addTransition(t) for v in ['action', 'review_history', 'actor', 'comments', 'time']: wf.v...
sdef.setPermission('Modify portal content', 0, ['Employee', 'Manager', 'Owner'])
sdef.setPermission('Modify portal content', 0, ['Customer', 'Employee', 'Manager', 'Owner'])
sdef = wf.states['open']
new_state_id="""in-progress""",
new_state_id="""activated""",
tdef = wf.transitions['activate']
tdef = wf.transitions['retract'] tdef.setProperties(title="""retracts content""", new_state_id="""open""",
tdef = wf.transitions['accept'] tdef.setProperties(title="""start working""", new_state_id="""in-progress""",
tdef = wf.transitions['retract']
actbox_name="""Retract""",
actbox_name="""Accept""",
tdef = wf.transitions['retract']
prefix=self.acl_users.getGroupPrefix()
try: import Products.PlonePAS except ImportError: prefix=self.acl_users.getGroupPrefix() else: prefix=''
def getMembers(self, role='Employee'): """ """ grp = getToolByName(self, 'portal_groups') mem = getToolByName(self, 'portal_membership') prefix=self.acl_users.getGroupPrefix() list1 = [] for user, roles in self.get_local_roles(): if role in roles: if string.find(user, prefix) == 0: for i1 in grp.getGroupById(user).getG...
if string.find(user, prefix) == 0:
if prefix != '' and string.find(user, prefix) == 0:
def getMembers(self, role='Employee'): """ """ grp = getToolByName(self, 'portal_groups') mem = getToolByName(self, 'portal_membership') prefix=self.acl_users.getGroupPrefix() list1 = [] for user, roles in self.get_local_roles(): if role in roles: if string.find(user, prefix) == 0: for i1 in grp.getGroupById(user).getG...
self.background_color = (1,1,1,1)
def __init__( self, paper): cairo_exporter.__init__( self, paper, converter_class=tk2cairo)
context.set_source_rgb( 1, 1, 1)
context.set_source_rgba( *self.background_color)
def init_context( self): """to be overriden; should be called after init_surface""" context = cairo.Context( self.surface) context.set_source_rgb( 1, 1, 1) context.rectangle( 0, 0, self.pagesize[0], self.pagesize[1]) context.fill() return context
title=_('PNG resolution'),
title=_('PNG resolution and background color'),
def __init__( self, parent, x, y): self.orig_x = int( x) self.orig_y = int( y)
Tkinter.Label(self.dialog.interior(), text=_("Set the PNG picture resolution using one of the bellow criteria.")).pack( pady=10, anchor="w", expand="1", padx=5)
Tkinter.Label(self.dialog.interior(), text=_("Set the PNG picture resolution and background color using one of the criteria below.")).pack( pady=10, anchor="w", expand="1", padx=5)
def __init__( self, parent, x, y): self.orig_x = int( x) self.orig_y = int( y)
if b.type == 'n': if not (b.order == 2 and b.center): x1, y1, x2, y2 = reduce( operator.add, [o.get_xy() for o in b.get_atoms()]) line = dom_extensions.elementUnder( l_group, 'line', (( 'x1', str( round( x1))), ( 'y1', str( round( y1))), ( 'x2', str( round( x2))), ( 'y2', str( round( y2))))) if b.second: x1, y1, x2, y2...
if b.type == 'h': items = b.items else: if b.center: if not b.order == 2: print "shit!" items = [] else: items = [b.item] items += b.second items += b.third if b.type in 'nbh': convert = lambda x: str( x) for i in items:
def add_bond( self, b): """adds bond item to SVG document""" if b.line_width != 1.0 or b.line_color != '#000': l_group = dom_extensions.elementUnder( self.group, 'g', (( 'stroke-width', str( b.line_width)), ( 'stroke', b.line_color))) else: l_group = self.group #dom_extensions.elementUnder( self.group, 'g') if b.type =...
(( 'x1', str( x1)), ( 'y1', str( y1)), ( 'x2', str( x2)), ( 'y2', str( y2))))
(( 'x1', convert( x1)), ( 'y1', convert( y1)), ( 'x2', convert( x2)), ( 'y2', convert( y2)))) elif b.type == 'w': for i in items: x1, y1, x2, y2, x3, y3 = self.paper.coords( b.item) line = dom_extensions.elementUnder( l_group, 'polygon', (( 'fill', b.line_color), ( 'stroke', b.line_color), ( 'points', '%d %d %d %d %d %...
def add_bond( self, b): """adds bond item to SVG document""" if b.line_width != 1.0 or b.line_color != '#000': l_group = dom_extensions.elementUnder( self.group, 'g', (( 'stroke-width', str( b.line_width)), ( 'stroke', b.line_color))) else: l_group = self.group #dom_extensions.elementUnder( self.group, 'g') if b.type =...