rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
pkg_cmd = "%s --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' '" % (options.pkg_dmg, self.build) | if options.quiet: quiet_flag = "--verbosity 0" else: quiet_flag = "" pkg_cmd = "%s --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' ' %s" % (options.pkg_dmg, self.build, quiet_flag) | def repackBuild(self): pkg_cmd = "%s --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' '" % (options.pkg_dmg, self.build) shellCommand(pkg_cmd) |
class RepackWin32(RepackBase): | class RepackWin(RepackBase): | def cleanup(self): super(RepackMac, self).cleanup() rmdirRecursive("stage") rmdirRecursive(self.mountpoint) |
repack_info): super(RepackWin32, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "win32" | platform_formatted, repack_info): super(RepackWin, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, platform_formatted, repack_info) | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info): super(RepackWin32, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "win32" |
super(RepackWin32, self).copyFiles('nonlocalized') | super(RepackWin, self).copyFiles('nonlocalized') | def copyFiles(self): super(RepackWin32, self).copyFiles('nonlocalized') |
zip_cmd = "%s a \"%s\" nonlocalized" % (SEVENZIP_BIN, self.build) | if options.quiet: zip_redirect = ">/dev/null" else: zip_redirect = "" zip_cmd = "%s a \"%s\" nonlocalized %s" % (SEVENZIP_BIN, self.build, zip_redirect) | def repackBuild(self): zip_cmd = "%s a \"%s\" nonlocalized" % (SEVENZIP_BIN, self.build) shellCommand(zip_cmd) |
repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) | platform_formatted, repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, platform_formatted, repack_info) | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.sbox_path = sbox_path self.sbox_home = sbox_home self.tmpdir = "%s/tmp_deb" % self.... |
self.platform = platform_formatted | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.sbox_path = sbox_path self.sbox_home = sbox_home self.tmpdir = "%s/tmp_deb" % self.... | |
default_platforms = ['linux-i686', 'mac', 'win32'] repack_build = {'linux-i686': RepackLinux, 'mac': RepackMac, 'win32': RepackWin32, 'maemo4': RepackMaemo, 'maemo5-gtk': RepackMaemo | default_platforms = ['linux-i686', 'linux-x86_64', 'mac', 'mac64', 'win32'] repack_build = {'linux-i686': RepackLinux, 'linux-x86_64': RepackLinux, 'mac': RepackMac, 'mac64': RepackMac, 'win32': RepackWin, 'win64-x86_64': RepackWin, 'maemo4': RepackMaemo, 'maemo5-gtk': RepackMae... | def getSingleFileFromHg(file): file_path = os.path.basename(file) url = os.path.join(options.hgroot, options.repo, 'raw-file', options.tag, file) return retrieveFile(url, file_path) |
help="Specify platform (multiples ok)." | help="Specify platform (multiples ok, e.g. --platform win32 --platform mac64)." | def getSingleFileFromHg(file): file_path = os.path.basename(file) url = os.path.join(options.hgroot, options.repo, 'raw-file', options.tag, file) return retrieveFile(url, file_path) |
win32_candidates_web_dir = candidates_web_dir | win_candidates_web_dir = candidates_web_dir | def getSingleFileFromHg(file): file_path = os.path.basename(file) url = os.path.join(options.hgroot, options.repo, 'raw-file', options.tag, file) return retrieveFile(url, file_path) |
win32_candidates_web_dir = candidates_web_dir + '/unsigned' | win_candidates_web_dir = candidates_web_dir + '/unsigned' | def getSingleFileFromHg(file): file_path = os.path.basename(file) url = os.path.join(options.hgroot, options.repo, 'raw-file', options.tag, file) return retrieveFile(url, file_path) |
candidates_dir = win32_candidates_web_dir | candidates_dir = win_candidates_web_dir | def getSingleFileFromHg(file): file_path = os.path.basename(file) url = os.path.join(options.hgroot, options.repo, 'raw-file', options.tag, file) return retrieveFile(url, file_path) |
def parseRepackConfig(file): | def isMaemo(platform): if (platform.find('maemo') != -1): return True return False def parseRepackConfig(file, platforms): | def parseRepackConfig(file): config = {} config['platforms'] = [] f= open(file, 'r') for line in f: line = line.rstrip("\n") [key, value] = line.split('=',2) value = value.strip('"') if key == 'dist_id': config['dist_id'] = value continue if key == 'locales': config['locales'] = value.split(' ') continue if isLinux(ke... |
if isLinux(key) or isMac(key) or isWin(key): if value == 'true': | if isLinux(key) or isMac(key) or isWin(key) or isMaemo(key): if key in platforms and value == 'true': | def parseRepackConfig(file): config = {} config['platforms'] = [] f= open(file, 'r') for line in f: line = line.rstrip("\n") [key, value] = line.split('=',2) value = value.strip('"') if key == 'dist_id': config['dist_id'] = value continue if key == 'locales': config['locales'] = value.split(' ') continue if isLinux(ke... |
return config | if config['platforms']: return config | def parseRepackConfig(file): config = {} config['platforms'] = [] f= open(file, 'r') for line in f: line = line.rstrip("\n") [key, value] = line.split('=',2) value = value.strip('"') if key == 'dist_id': config['dist_id'] = value continue if key == 'locales': config['locales'] = value.split(' ') continue if isLinux(ke... |
if isMaemo(platform): deb_name_url = "http://%s%s/%s/%s/deb_name.txt" % \ (options.staging_server, candidates_web_dir, platform_formatted, locale) filename = re.sub('\n', '', Popen(['curl', deb_name_url], stdout=subprocess.PIPE).communicate()[0]) return filename | def getFilename(version, platform, locale, file_ext): '''Returns the properly formatted filename based on the version string. File location/nomenclature changed starting with 3.5. ''' version_formatted = version # Deal with alpha/beta releases. m = re.match('(\d\.\d)(a|b|rc)(\d+)', version) if m: if m.group(2) == 'b':... | |
class RepackMaemo(RepackBase): def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "maemo" self.sbox_path = sbox_path self.s... | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) | |
'win32': RepackWin32 | 'win32': RepackWin32, 'maemo': RepackMaemo | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
if not which("7za"): | if "win32" in options.platforms and not which("7za"): | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
if not which(options.pkg_dmg): | if "mac" in options.platforms and not which(options.pkg_dmg): | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
candidates_web_dir = "/pub/mozilla.org/firefox/nightly/%s-candidates/build%s" % (options.version, options.build_number) | candidates_web_dir = "/pub/mozilla.org/%s/%s-candidates/build%s" % (options.nightly_dir, options.version, options.build_number) | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
repack_info = parseRepackConfig(repack_cfg) | repack_info = parseRepackConfig(repack_cfg, options.platforms) if not repack_info: continue | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
platform_formatted); | platform_formatted) | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
if (platform.find('mac64') != -1): | if platform.find('macosx64') != -1 or (platform.find('mac64') != -1): | def isMac64(platform): if (platform.find('mac64') != -1): return True return False |
if platform_formatted in platforms and value.lower() == 'true': | if platform_formatted in [getFormattedPlatform(p) for p in platforms] and value.lower() == 'true': | def parseRepackConfig(file, platforms): config = {} config['platforms'] = [] f= open(file, 'r') for line in f: line = line.rstrip("\n") [key, value] = line.split('=',2) value = value.strip('"') if key == 'dist_id': config['dist_id'] = value continue if key == 'locales': config['locales'] = value.split(' ') continue if ... |
self.members = info[0][1]["memberUid"] | self.members = self.__unames_from_dn( info[0][1]["memberUid"] ) | def __load(self, name): info = get_conn().search_st( "ou=groups,o=sr", ldap.SCOPE_ONELEVEL, filterstr="(&(objectClass=posixGroup)(cn=%s))" % ( name ) ) if len(info) == 1: self.dn = info[0][0] self.gid = info[0][1]["gidNumber"] if "memberUid" in info[0][1].keys(): self.members = info[0][1]["memberUid"] else: self.membe... |
modlist.append( ("memberUid", self.members) ) | modlist.append( ("memberUid", self.__unames_to_dn( self.members ) ) ) | def __save_new(self): modlist = [ ("objectClass", "posixGroup"), ("cn", self.name), ("gidNumber", str(self.gid)) ] |
self.members ) ] | self.__unames_to_dn( self.members ) ) ] | def __update(self): if len(self.new_users) == 0 and len(self.removed_users) == 0: return True |
userl = [user.username] | userl = [userl.username] | def user_rm(self,userl): """Remove a user from a group""" if userl.__class__ is users.user: userl = [user.username] elif type(userl) is not types.ListType: userl = [userl] for user in userl: if user in self.members: self.members.remove(user) self.removed_users.append(user) |
ret = '' for i in range(len(title)): if title[i].isalnum(): ret += title[i].lower() elif ret[len(ret)-1].isalnum() and title[i] not in "'\",.?": ret += '_' return ret | new = "" for char in title: if char.isalnum(): new += char.lower() elif not new.endswith("_") and char not in "'\",.?": new += "_" return new | def title_to_filename(title): 'Returns a filename with letters and underscores only.' #TODO May need to translate foreign characters to english, or allow # foreign characters in the filename. ret = '' for i in range(len(title)): if title[i].isalnum(): ret += title[i].lower() elif ret[len(ret)-1].isalnum() and title[i] ... |
webbrowser.open(HELP_URL) | webbrowser.open("file:"+pathname2url(HELP_URL)) | def _show_help(self, *args): 'Show the help pages.' webbrowser.open(HELP_URL) |
self.show_all() | def _ready(self): "Called when ExpoSong is fully loaded." gobject.timeout_add(200, splash.splash.destroy) self.show_all() statusbar.statusbar.output(_("Ready")) exposong.log.info('Ready.') return False | |
title = "" try: title = '^'+{'v':'verse','c':'chorus','b':'bridge', 'e':'end(ing)?','r':'refrain'}[order_value[0].lower()] if len(order_value) == 1 or order_value[1:] == '1': title += '( 1)?' else: title += ' '+order_value[1:] title += '$' except KeyError: return False | def get_slide_from_order(self, order_value): 'Gets the slide index.' title = "" try: title = '^'+{'v':'verse','c':'chorus','b':'bridge', 'e':'end(ing)?','r':'refrain'}[order_value[0].lower()] if len(order_value) == 1 or order_value[1:] == '1': title += '( 1)?' else: title += ' '+order_value[1:] title += '$' except KeyE... | |
if re.match(title,sl.title.lower()): | if re.match(order_value,sl.title.lower()): | def get_slide_from_order(self, order_value): 'Gets the slide index.' title = "" try: title = '^'+{'v':'verse','c':'chorus','b':'bridge', 'e':'end(ing)?','r':'refrain'}[order_value[0].lower()] if len(order_value) == 1 or order_value[1:] == '1': title += '( 1)?' else: title += ' '+order_value[1:] title += '$' except KeyE... |
self._logo = True self._black = self._background = False self.draw() | if exposong.prefs.config['pres.logo'] != None: self._logo = True self._black = self._background = False self.draw() else: dialog = gtk.MessageDialog(exposong.application.main, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, _('No Logo set. Do you want to choose a Logo now?')) dialog.set_title( _("Set Logo?")... | def to_logo(self, button): 'Set the screen to black.' self._logo = True self._black = self._background = False self.draw() |
parser = etree.XMLParser(remove_blank_text=True) | parser = etree.XMLParser() | def __init__(self, opensong_file): #print('Parsing...') parser = etree.XMLParser(remove_blank_text=True) self.osong = etree.parse(opensong_file) self.olyrics = etree.ElementTree(etree.Element('song')) |
self.olyrics.write(openlyrics_file, encoding='utf-8', pretty_print=True, xml_declaration=True) | self.olyrics.write(openlyrics_file, encoding='utf-8') | def save(self, openlyrics_file): #print('Saving...') # write openlyrics self.olyrics.write(openlyrics_file, encoding='utf-8', pretty_print=True, xml_declaration=True) |
schema = etree.parse(SCHEMAFILE) converter.validate(openlyrics_file, schema.getroot()) | def main(): if len(sys.argv) != 3: print('Usage:') print(' python %s opensong_file openlyrics_file.xml' % __file__) exit(1) else: opensong_file = sys.argv[1] openlyrics_file = sys.argv[2] if not os.path.exists(opensong_file): print('ERROR: File %s does not exists.' % opensong_file) exit(2) if os.path.exists(openlyr... | |
newimg = os.path.join(DATA_PATH, 'image', os.path.split(self.image)[1]) | imgname = ("_"+random_string(6)).join( os.path.splitext(os.path.basename(self.image))) newimg = os.path.join(DATA_PATH, 'image', imgname) | def __init__(self, pres, value): self.pres = pres if(isinstance(value, xml.dom.Node)): self.title = value.getAttribute("title") imgdom = value.getElementsByTagName("img").item(0) if imgdom: self.image = imgdom.getAttribute("src") self.rotate = get_rotate_const(imgdom.getAttribute("rotate")) elif(isinstance(value, str)... |
os.remove(model.get_value(s_iter, 0)) | self._delete_on_remove += [model.get_value(s_iter, 0)] if os.path.isfile(thmb): self._delete_on_remove += [thmb] | def _on_img_del(self, button, treeview): 'Remove an image from the presentation.' (model, s_iter) = treeview.get_selection().get_selected() if s_iter: if model.get_value(s_iter, 0).startswith(DATA_PATH): os.remove(model.get_value(s_iter, 0)) model.remove(s_iter) |
'Set the background of `widget` to `color`.' | 'Set the background of `widget` to a color or image.' | def _set_background(self, widget, ccontext = None, bounds = None): 'Set the background of `widget` to `color`.' if not widget.window: return False if ccontext is None: ccontext = widget.window.cairo_create() if bounds is None: bounds = widget.window.get_size() if self._black and widget is self.pres: bg = (0, 0, 0) el... |
bg = (0, 0, 0) | bgtype = 'color' bgcolor1 = bgcolor2 = (0, 0, 0) | def _set_background(self, widget, ccontext = None, bounds = None): 'Set the background of `widget` to `color`.' if not widget.window: return False if ccontext is None: ccontext = widget.window.cairo_create() if bounds is None: bounds = widget.window.get_size() if self._black and widget is self.pres: bg = (0, 0, 0) el... |
attrs = pango.AttrList() attrs.insert(pango.AttrFontDesc(pango.FontDescription("Sans Bold "+ str(int(screenH/54.0))), end_index = len(ftext)*3)) layout.set_attributes(attrs) | layout.set_font_description(pango.FontDescription("Sans Bold "+str(int(screenH/54.0)))) | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... |
attrs = pango.AttrList() attrs.insert(pango.AttrFontDesc(pango.FontDescription("Sans Bold "+str(size)) , end_index = len(str(slide.body_text()))*3)) layout.set_attributes(attrs) | layout.set_font_description(pango.FontDescription("Sans Bold "+str(size))) | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... |
attrs.insert(pango.AttrFontDesc(pango.FontDescription("Sans Bold "+str(size)), end_index = len(slide.body_text())*3)) layout.set_attributes(attrs) | layout.set_font_description(pango.FontDescription("Sans Bold "+str(size))) | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... |
attrs = pango.AttrList() | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... | |
attrs.insert(pango.AttrFontDesc(pango.FontDescription("Sans Bold "+str(notify_sz)), end_index = len(self._notification)*3)) layout.set_attributes(attrs) | layout.set_font_description(pango.FontDescription("Sans Bold "+str(notify_sz))) | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... |
attrs.insert(pango.AttrFontDesc(pango.FontDescription("Sans Bold "+str(notify_sz)), end_index = len(slide.body_text())*3)) layout.set_attributes(attrs) | layout.set_font_description(pango.FontDescription("Sans Bold "+str(notify_sz))) | def _draw(self, widget): 'Render `widget`.' if not widget.window or not widget.window.is_viewable(): return False ccontext = widget.window.cairo_create() screenW, screenH = widget.window.get_size() if widget is self.preview and self.pres.window and self.pres.window.is_viewable(): #Scale if the presentation window size... |
if not hasattr(self,'pixbuf') or bounds[0] <> self.pixbuf.get_width() or bounds[1] <> self.pixbuf.get_height(): | print "ImageDraw: ",bounds if not hasattr(self,'pixbuf') or (bounds[0] <> self.pixbuf.get_width() and bounds[1] <> self.pixbuf.get_height()): print " Reloading." | def draw(self, ccontext, bounds): 'Override screen to draw an image instead of text.' #draw a black background ccontext.set_source_rgb(0, 0, 0) ccontext.paint() if not hasattr(self,'pixbuf') or bounds[0] <> self.pixbuf.get_width() or bounds[1] <> self.pixbuf.get_height(): try: exposong.log.debug('Opening file "%s" fo... |
return ccontext.set_source_pixbuf(self.pixbuf, (bounds[0]-self.pixbuf.get_width())/2,\ (bounds[1]-self.pixbuf.get_height())/2) | return False ccontext.set_source_pixbuf(self.pixbuf, (bounds[0]-self.pixbuf.get_width())/2, (bounds[1]-self.pixbuf.get_height())/2) | def draw(self, ccontext, bounds): 'Override screen to draw an image instead of text.' #draw a black background ccontext.set_source_rgb(0, 0, 0) ccontext.paint() if not hasattr(self,'pixbuf') or bounds[0] <> self.pixbuf.get_width() or bounds[1] <> self.pixbuf.get_height(): try: exposong.log.debug('Opening file "%s" fo... |
return | return True | def draw(self, ccontext, bounds): 'Override screen to draw an image instead of text.' #draw a black background ccontext.set_source_rgb(0, 0, 0) ccontext.paint() if not hasattr(self,'pixbuf') or bounds[0] <> self.pixbuf.get_width() or bounds[1] <> self.pixbuf.get_height(): try: exposong.log.debug('Opening file "%s" fo... |
dlg.hide() | dlg.destroy() | def export_sched(self, *args): 'Export a single schedule list to file.' sched = schedlist.schedlist.get_active_item() if not sched: return False if not sched.filename: sched.save() dlg = gtk.FileChooserDialog(_("Export Schedule"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_... |
'Export the full library to file.' | 'Export the full library to tar-compressed file.' | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... |
oldpath = os.getcwd() os.chdir(DATA_PATH) | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... | |
tar.add("pres/"+library.get_value(itr, 0).filename) | fn = library.get_value(itr, 0).filename tar.add(fn, os.path.join("pres", os.path.split(fn)[1])) | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... |
tar.add("image/"+slide.image.rpartition('/')[2]) | tar.add(slide.image, os.path.join("image", os.path.split(slide.image)[1])) | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... |
tar.add("sched/"+model.get_value(itr, 0).filename) | fn = model.get_value(itr, 0).filename tar.add(fn, os.path.join("sched", os.path.split(fn)[1])) | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... |
os.chdir(oldpath) | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... | |
dlg.hide() | dlg.destroy() | def export_lib(self, *args): 'Export the full library to file.' dlg = gtk.FileChooserDialog(_("Export Library"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) dlg.set_do_overwrite_confirmation(True) dlg.set_cu... |
dlg.get_filename().rpartition(os.sep)[2].partition(".")[0]) | os.path.split(dlg.get_filename())[1].rstrip(".expo")) | def import_file(self, *args): 'Import a schedule or library.' dlg = gtk.FileChooserDialog(_("Import"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) if dlg.run() == gtk.RESPONSE_ACCEPT: tar = tarfile.open(dlg.... |
dlg.hide() | dlg.destroy() | def import_file(self, *args): 'Import a schedule or library.' dlg = gtk.FileChooserDialog(_("Import"), exposong.application.main, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) dlg.add_filter(_FILTER) if dlg.run() == gtk.RESPONSE_ACCEPT: tar = tarfile.open(dlg.... |
self._logo_pbuf = gtk.gdk.pixbuf_new_from_file_at_size( | self._logo_pbuf = pb_new_at_size( | def _set_background(self, widget, ccontext = None, bounds = None): 'Set the background of `widget` to a color or image.' if not widget.window: return False if ccontext is None: ccontext = widget.window.cairo_create() if bounds is None: bounds = widget.window.get_size() if self._black and widget is self.pres: bgtype =... |
pixbuf = gtk.gdk.pixbuf_new_from_file(bgimage) | pixbuf = pb_new(bgimage) | def _set_background(self, widget, ccontext = None, bounds = None): 'Set the background of `widget` to a color or image.' if not widget.window: return False if ccontext is None: ccontext = widget.window.cairo_create() if bounds is None: bounds = widget.window.get_size() if self._black and widget is self.pres: bgtype =... |
('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, | ('Present', 'screen-present', _('_Present'), "F5", None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, | ('Background', 'screen-bg', _('Bac_kground'), None, None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
('Logo', None, _('Lo_go'), "<Ctrl>g", None, | ('Logo', 'screen-logo', _('Lo_go'), "<Ctrl>g", None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
('Black Screen', None, _('_Black Screen'), "b", None, | ('Black Screen', 'screen-black', _('_Black Screen'), "b", None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
('Freeze', None, _('_Freeze'), None , None, | ('Freeze', 'screen-freeze', _('_Freeze'), None , None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
('Hide', gtk.STOCK_CLOSE, _('Hi_de'), "Escape", None, | ('Hide', 'screen-hide', _('Hi_de'), "Escape", None, | def merge_menu(cls, uimanager): 'Merge new values with the uimanager.' global screen cls._actions = gtk.ActionGroup('screen') cls._actions.add_actions([ ('Present', gtk.STOCK_FULLSCREEN, _('_Present'), "F5", None, screen.show), ('Background', gtk.STOCK_CLEAR, _('Bac_kground'), None, None, screen.to_background), ('Logo'... |
enable = isinstance(sched, exposong.schedule.Schedule) and not sched.builtin | try: enable = isinstance(sched, exposong.schedule.Schedule) and not sched.builtin except UnboundLocalError: enable = False | def _on_schedule_activate(self, *args): 'Change the presentation list to the current schedule.' if self.has_selection(): sched = self.get_active_item() if isinstance(sched, exposong.schedule.Schedule): exposong.preslist.preslist.set_model(sched) exposong.preslist.preslist.columns_autosize() sched.refresh_model() if sch... |
os.remove("data/sched/"+item.filename) | os.remove(os.path.join(DATA_PATH, "sched",item.filename)) | def _on_sched_delete(self, action): 'Delete the selected schedule.' item = self.get_active_item() if not item or item.builtin: return False win = self while not isinstance(win, gtk.Window): win = win.get_parent() dialog = gtk.MessageDialog(win, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, _('Are you sure ... |
filename = find_freefile(os.path.join(directory,tfile+".xml")) return filename | path = find_freefile(os.path.join(directory,tfile+".xml")) return path | def check_filename(title, path): '''Gets a filename that is not being used. If a cur_name is supplied, it checks to see if it matches the current filename, or if not, deletes the file and returns the new filename.''' if os.path.isdir(path): directory = path filename = '' elif os.path.isfile(path): (directory, filename... |
def find_freefile(fl): | def find_freefile(filename): | def find_freefile(fl): """Find an open filename. This makes sure the file doesn't exist, and if it does, add a -1, or -2, until the file won't overwrite an existing file. Needs changes to work with extensions such as ".tar.gz" which have multiple periods.""" fl = fl.rpartition(".") fl = [fl[0], "", "."+fl[2]] if fl[0]... |
fl = fl.rpartition(".") | fl = filename.rpartition(".") | def find_freefile(fl): """Find an open filename. This makes sure the file doesn't exist, and if it does, add a -1, or -2, until the file won't overwrite an existing file. Needs changes to work with extensions such as ".tar.gz" which have multiple periods.""" fl = fl.rpartition(".") fl = [fl[0], "", "."+fl[2]] if fl[0]... |
editor.run() if editor.changed: self.title = editor.get_slide_title() self.text = editor.get_slide_text() return True return False | while True: if editor.run() == gtk.RESPONSE_ACCEPT: if editor.changed: self.title = editor.get_slide_title() self.text = editor.get_slide_text() return True else: return False | def _edit_window(self, parent): editor = SlideEdit(parent, self) editor.run() if editor.changed: self.title = editor.get_slide_title() self.text = editor.get_slide_text() return True return False |
else: self._save() self.destroy() | return False self._save() self.destroy() | def _quit_with_save(self, event, *args): if self._get_title_value() == "": info_dialog = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("Please enter a Title.")) info_dialog.run() info_dialog.destroy() self._title_entry.grab_focus() else: self._save() self.destroy() |
self.get_model().append((item, item.title, item.get_type())) | self.get_model().append((item, item.get_title(), item.get_type())) | def append(self, item): 'Add a presentation to the list.' self.get_model().append((item, item.title, item.get_type())) |
_('Are you sure you want to delete "%s" from your library?') % item.title) | _('Are you sure you want to delete "%s" from your library?') % item.get_title()) | def _on_pres_delete(self, *args): 'Delete the selected presentation.' item = self.get_active_item() if not item: return False dialog = gtk.MessageDialog(exposong.application.main, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_YES_NO, _('Are you sure you want to delete "%s" from your library?') % item.title) dialog... |
author = '; '.join( '%s: %s' % (auth_types.get(a.type,_("Written By")), | author = '; '.join(u'%s: %s' % (auth_types.get(a.type,_("Written By")), | def footer_text(self): 'Draw text on the footer.' jn = ['"%s"' % self.pres.title] # TODO List only translators for the current translation. author = '; '.join( '%s: %s' % (auth_types.get(a.type,_("Written By")), str(a)) for a in self.pres.song.props.authors ) if len(author) > 0: jn.append(author) if len(self.pres.song... |
regex = re.compile("\\b"+re.escape(text), re.I) | regex = re.compile("\\b"+re.escape(text), re.U|re.I) | def matches(self, text): 'Tests to see if the presentation matches `text`.' regex = re.compile("\\b"+re.escape(text), re.I) if regex.search(self.title): return True if hasattr(self.slides[0], 'text') and regex.search(" ".join(\ s.title+" "+s.text for s in self.slides)): return True |
if hasattr(self.slides[0], 'text') and regex.search(" ".join(\ s.title+" "+s.text for s in self.slides)): return True | if self.slides: if hasattr(self.slides[0], 'text') and regex.search(" ".join(\ s.title+" "+s.text for s in self.slides)): return True | def matches(self, text): 'Tests to see if the presentation matches `text`.' regex = re.compile("\\b"+re.escape(text), re.I) if regex.search(self.title): return True if hasattr(self.slides[0], 'text') and regex.search(" ".join(\ s.title+" "+s.text for s in self.slides)): return True |
gtk.source_remove(self.last_tag) | gobject.source_remove(self.last_tag) | def _del_timer(self): if self.last_tag: gtk.source_remove(self.last_tag) |
d = os.path.expanduser("~", "exposong") | d = os.path.join(os.path.expanduser("~"), "exposong") | def __init__(self): ConfigParser.SafeConfigParser.__init__(self) if os.name == 'nt': try: d = os.path.join(os.environ["LOCALAPPDATA"], "exposong") except KeyError: d = os.path.expanduser("~", "exposong") else: d = os.path.join(os.path.expanduser("~"), ".config", "exposong") if not os.path.exists(d): os.makedirs(d) cfil... |
return False self._save() self.destroy() | else: self._save() self.destroy() | def _quit_with_save(self, event, *args): if self._get_title_value() == "": info_dialog = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, _("Please enter a Title.")) info_dialog.run() info_dialog.destroy() self._title_entry.grab_focus() return False self._save() self.destroy() |
smach.logdebug("Making const '%s'" % str(name)) | smach.logdebug("Making const '%s'" % str(obj)) | def get_const(obj): """Get a const reference to an object if it has "user-defined" attributes.""" if hasattr(obj,'__dict__'): smach.logdebug("Making const '%s'" % str(name)) return Const(obj) else: return obj |
type = None | type = 'd' path = "" | def get_file_type_and_image(path): try: st = os.stat(path) if stat.S_ISREG(st.st_mode): return 'f', IM_FILE elif stat.S_ISDIR(st.st_mode): return 'd', IM_FOLDER except OSError: pass return None, None |
tree.SetItemImage(self.item, IM_FOLDER) for node in self.children: item = tree.AppendItem(self.item, node.label, IM_FOLDER) tree.SetItemNode(item, node) tree.SetItemHasChildren(item, True) | if not self.populated: self.populated = True tree.SetItemImage(self.item, IM_FOLDER) for node in self.children: item = tree.AppendItem(self.item, node.label, IM_FOLDER) tree.SetItemNode(item, node) tree.SetItemHasChildren(item, True) | def expand(self, tree, monitor, filter): tree.SetItemImage(self.item, IM_FOLDER) for node in self.children: item = tree.AppendItem(self.item, node.label, IM_FOLDER) tree.SetItemNode(item, node) tree.SetItemHasChildren(item, True) |
yield node.expand(self, self.monitor, self.filter) | t = node.expand(self, self.monitor, self.filter) if isinstance(t, Task): yield t | def ExpandNode(self, node): yield node.expand(self, self.monitor, self.filter) self.Expand(node.item) |
self.SetItemNode(rootitem, self.toplevel[0]) toplevel_items = [rootitem] | rootnode = self.toplevel[0] | def InitializeTree(self): self.DeleteAllItems() rootitem = self.AddRoot("") if len(self.toplevel) == 1: self.SetItemNode(rootitem, self.toplevel[0]) toplevel_items = [rootitem] else: self.SetItemNode(rootitem, FSNode()) toplevel_items = [] for node in self.toplevel: item = self.AppendItem(rootitem, node.label, IM_FOLDE... |
self.SetItemNode(rootitem, FSNode()) toplevel_items = [] for node in self.toplevel: item = self.AppendItem(rootitem, node.label, IM_FOLDER) self.SetItemNode(item, node) self.SetItemHasChildren(item, True) toplevel_items.append(item) for item in toplevel_items: try: node = self.GetPyData(item) yield self.ExpandNode(node... | rootnode = SimpleNode("", self.toplevel) self.SetItemNode(rootitem, rootnode) yield self.ExpandNode(rootnode) | def InitializeTree(self): self.DeleteAllItems() rootitem = self.AddRoot("") if len(self.toplevel) == 1: self.SetItemNode(rootitem, self.toplevel[0]) toplevel_items = [rootitem] else: self.SetItemNode(rootitem, FSNode()) toplevel_items = [] for node in self.toplevel: item = self.AppendItem(rootitem, node.label, IM_FOLDE... |
p["expanded"] = [node.path for node in expanded] | p["expanded"] = [node.path for node in expanded if node.path] | def SavePerspective(self): p = {} expanded = [] self.FindExpandedNodes(self.GetRootItem(), expanded) if expanded: p["expanded"] = [node.path for node in expanded] selected = self.GetSelectedNode() if selected and selected.type in 'fd': p["selected"] = selected.path return p |
if selected and selected.type in 'fd': | if selected and selected.type in 'fd' and selected.path: | def SavePerspective(self): p = {} expanded = [] self.FindExpandedNodes(self.GetRootItem(), expanded) if expanded: p["expanded"] = [node.path for node in expanded] selected = self.GetSelectedNode() if selected and selected.type in 'fd': p["selected"] = selected.path return p |
if node.type == 'd': if node.path in paths: yield self.ExpandNode(node) for child_item in iter_tree_children(self, item): yield self.ExpandPathNodes(child_item, paths) | if node.type == 'd' and (node.path in paths or not node.path): yield self.ExpandNode(node) for child_item in iter_tree_children(self, item): yield self.ExpandPathNodes(child_item, paths) | def ExpandPathNodes(self, item, paths): node = self.GetPyData(item) if node.type == 'd': if node.path in paths: yield self.ExpandNode(node) for child_item in iter_tree_children(self, item): yield self.ExpandPathNodes(child_item, paths) |
close_fds=True, shell=True, cwd=cwd, env=env) | close_fds=(sys.platform != "win32"), shell=True, cwd=cwd, env=env) | def run(self, args, env=None, cwd=None): if self.process: return |
text = text.lower() | text_lower = text.lower() | def dirtree_insert(tree, parent_item, text, image): i = 0 text = text.lower() for i, item in enumerate(iter_tree_children(tree, parent_item)): if image != IM_FILE and tree.GetItemImage(item) == IM_FILE: return tree.InsertItemBefore(parent_item, i, text, image) elif tree.GetItemText(item).lower() > text: if not (image =... |
elif tree.GetItemText(item).lower() > text: | if item_text.lower() > text_lower: | def dirtree_insert(tree, parent_item, text, image): i = 0 text = text.lower() for i, item in enumerate(iter_tree_children(tree, parent_item)): if image != IM_FILE and tree.GetItemImage(item) == IM_FILE: return tree.InsertItemBefore(parent_item, i, text, image) elif tree.GetItemText(item).lower() > text: if not (image =... |
wx.CallAfter(self.OnFileSystemChanged, evt) | wx.CallLater(10, self.OnFileSystemChanged, evt) | def _OnFileSystemChanged(self, evt): wx.CallAfter(self.OnFileSystemChanged, evt) |
project = (yield async_call(read_project, filename)) yield self.LoadProject(project) | project = (yield self._OpenProject(filename)) | def OpenProject(self, filename): try: project = (yield async_call(read_project, filename)) yield self.LoadProject(project) except Exception, e: if isinstance(e, IOError) and e.errno == errno.ENOENT: dialogs.error(self, "Project file not found:\n\n" + filename) else: dialogs.error(self, "Error loading session:\n\n%s" % ... |
if isinstance(e, IOError) and e.errno == errno.ENOENT: dialogs.error(self, "Project file not found:\n\n" + filename) else: dialogs.error(self, "Error loading session:\n\n%s" % traceback.format_exc()) | self._ShowLoadProjectError(e) @managed("cm") @coroutine | def OpenProject(self, filename): try: project = (yield async_call(read_project, filename)) yield self.LoadProject(project) except Exception, e: if isinstance(e, IOError) and e.errno == errno.ENOENT: dialogs.error(self, "Project file not found:\n\n" + filename) else: dialogs.error(self, "Error loading session:\n\n%s" % ... |
return self.OpenProject(os.path.join(self.config_dir, "session")) | filename = os.path.join(self.config_dir, "session") try: yield self._OpenProject(filename) except Exception: try: yield self.LoadProject(Project(filename=filename)) except Exception, e: self._ShowLoadProjectError(e) | def OpenDefaultProject(self): return self.OpenProject(os.path.join(self.config_dir, "session")) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.