rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
base_filename = os.path.basename(self.photo.name)
def save(self): import os from PIL import Image from cStringIO import StringIO from django.core.files.uploadedfile import SimpleUploadedFile
self.thumbnail.save(suf.name.split('.')[-1]+'_thumbnail.png', suf, save=False)
thumbnail_basename = os.path.splitext(suf.name)[0] print "thumbnail basename = %s" % thumbnail_basename self.thumbnail.save(thumbnail_basename+'_thumbnail.png', suf, save=False)
def save(self): import os from PIL import Image from cStringIO import StringIO from django.core.files.uploadedfile import SimpleUploadedFile
elif event.keyval == clutter.keysyms.s: self.transient_message.message('this is a test')
def on_press(self, actor, event): """ Toplevel callback for when buttons are pressed. """ if event.keyval == clutter.keysyms.Escape: logging.info('Escape button pressed. Quitting jukebox.') clutter.main_quit() elif event.keyval == clutter.keysyms.space: logging.debug('Space button pressed which means credit insert.') l...
if hasattr(in_file, "split"):
if hasattr(in_file, 'capitalize'):
def __init__(self, in_file, tagVersion = ID3_ANY_VERSION): TagFile.__init__(self, in_file)
f = open(in_file, "rb"); elif hasattr(in_file, "read"):
f = open(in_file, "rb") else:
def __init__(self, in_file, tagVersion = ID3_ANY_VERSION): TagFile.__init__(self, in_file)
for screen in self.screens():
for screen in self.screens:
def update_screens(self): """ Iterate over screens asking them to update their contents.
random = models.BooleanField(default=True)
random = models.BooleanField(default=False)
def __unicode__(self): return self.caption
random = models.BooleanField(default=True)
random = models.BooleanField(default=False)
def __str__(self): return self.__unicode__()
if paid:
if self.paid:
def __unicode__(self): text = "%s - %s - %s" % (self.played_on, self.song.artist, self.song) if paid: text += ' P' if random: text += ' R' return text
if random:
if self.random:
def __unicode__(self): text = "%s - %s - %s" % (self.played_on, self.song.artist, self.song) if paid: text += ' P' if random: text += ' R' return text
song = QueuedPlay.objects.all()[0]
queued_play = QueuedPlay.objects.all()[0] song = queued_play.song
def next_song(): """ """ song = None if QueuedPlay.objects.count() > 0: song = QueuedPlay.objects.all()[0] return song
return self.title
lower_title = self.title.lower() if lower_title.endswith(', the'): basetitle = self.title[:-5] the = self.title[-3:] return the+' '+basetitle else: return self.title
def __unicode__(self): return self.title
return "%s - %s - %s" % (self.played_on, self.song.artist, self.song)
try: return "%s - %s - %s" % (self.played_on, self.song.artist, self.song) except Song.DoesNotExist: print "Error: Could not find the song for random play %s." % self.id return ""
def __unicode__(self): return "%s - %s - %s" % (self.played_on, self.song.artist, self.song)
return "%s - %s - %s" % (self.played_on, self.song.artist, self.song)
try: return "%s - %s - %s" % (self.played_on, self.song.artist, self.song) except Song.DoesNotExist: print "Error: Could not find the song for paid play %s." % self.id return ""
def __unicode__(self): return "%s - %s - %s" % (self.played_on, self.song.artist, self.song)
self.filename = in_file
self.fileName = in_file
def __init__(self, in_file): self.in_file = None self.fileName = str("") self.fileSize = int(0) self.tag = None # Number of seconds required to play the audio file. self.play_time = int(0)
self.filename = in_file.name
self.fileName = in_file.name
def __init__(self, in_file): self.in_file = None self.fileName = str("") self.fileSize = int(0) self.tag = None # Number of seconds required to play the audio file. self.play_time = int(0)
f = file(self.in_file, "rb");
f = open(in_file, "rb");
def __init__(self, in_file, tagVersion = ID3_ANY_VERSION): TagFile.__init__(self, in_file)
extras_require={'test': ['ipython', 'zope.testing', 'lxml', 'zope.testbrowser', 'repoze.vhm']},
extras_require={'test': ['ipython', 'zope.testing', 'lxml', 'zope.testbrowser', ]},
def read(rnames): setupdir = os.path.dirname( os.path.abspath(__file__)) return open( os.path.join(setupdir, *rnames) ).read()
result1 = loader.get_template("base.html").render(Context({'title':'MainPage'})) self.assertEqual(result1, u'<html><head></head><body>Welcome at MainPage</body></html>') result2 = loader.get_template("sub.html").render(Context({'title':'SubPage'})) self.assertEqual(result2, u'<html><head></head><body>This is SubPage</...
try: result1 = loader.get_template("base.html").render(Context({'title':'MainPage'})) self.assertEqual(result1, u'<html><head></head><body>Welcome at MainPage</body></html>')
def test_load_templates(self): self.test_basiscs() loader.template_source_loaders = [load_template_source] result1 = loader.get_template("base.html").render(Context({'title':'MainPage'})) self.assertEqual(result1, u'<html><head></head><body>Welcome at MainPage</body></html>')
def populate(self, name=None): """ Tries to find a template with the same name and populates the content field if found. """ if name is None: name = self.name try: source, origin = find_template(name) if source: self.content = source except TemplateDoesNotExist: pass
def __unicode__(self): return self.name
try: source, origin = find_template_source(self.name) if source: self.content = source except TemplateDoesNotExist: pass
self.populate()
def save(self, *args, **kwargs): self.last_changed = datetime.now() # If content is empty look for a template with the given name and # populate the template instance with its content. if not self.content: try: source, origin = find_template_source(self.name) if source: self.content = source except TemplateDoesNotExist...
if USE_CODEMIRROR: result.append(u"""
result.append(u"""
def render(self, name, value, attrs=None): result = [] result.append( super(CodeMirrorTextArea, self).render(name, value, attrs)) if USE_CODEMIRROR: result.append(u"""
widget=CodeMirrorTextArea({'rows': '24'}),
widget=TemplateContentTextArea({'rows': '24'}),
def render(self, name, value, attrs=None): result = [] result.append( super(CodeMirrorTextArea, self).render(name, value, attrs)) if USE_CODEMIRROR: result.append(u"""
raise IPTCError("can't initialize %s: %s" % (table,
raise IPTCError("can't initialize %s: %s" % (self.name,
def refresh(self): """Commit any pending operation and refresh the status of iptables.""" if self._handle: self._free()
text = RE_QUALIFIER_TITLE.sub('', text)
text = RE_QUALIFIER_TITLE.sub(r'\1', text)
def formatLink(match): if match.group(1).startswith(('w:', 'Appendix:Glossary', 'http:')): return match.group(2) or '' if ':' in match.group(1): return '' escaped_term = _urlescape(match.group(1).encode('utf8')).decode('utf8') if match.group(2): link_text = match.group(2) else: link_text = match.group(1) + match.group...
RE_EXAMPLE_BREAK = re.compile(r'(?:^|(?<=[^\w<]))(?=[<\'"\w])(.+)', re.UNICODE)
RE_EXAMPLE_BREAK = re.compile(r'(?:^|(?<=[^\w<])(?<!\[\[))(?=[<\[\'"\w])(.+)', re.UNICODE)
def _createSectionRegex(min_level, headers): template = r''' (?:^|\r|\n|\r\n) ={%(min_level)d,} (?:\{\{)? (%(headers)s) (?:\}\})? ={%(min_level)d,} \s* (?:^|\r|\n|\r\n) (.*?) (?:(?=(?:^|\r|\n|\r\n)=)|$) ''' headers = '|'.join(re.escape(i) for i in headers) return re.compile(template % locals(), re.VERBOSE | re.UNICODE...
RE_LINK = re.compile(r"\[\[(.*?)(?:\|(.*?))?\]\](\w*)", re.UNICODE) RE_LINK2 = re.compile(r"\[([^\[\]\s]*)\s([^\[\]]*)\]", re.UNICODE) RE_LINK_EXTERNAL = re.compile(r"(?<!\[)\[[^\[\]]*\](?!\])", re.UNICODE)
RE_LINK = re.compile(r'\[\[(.*?)(?:\|(.*?))?\]\](\w*)', re.UNICODE) RE_LINK2 = re.compile(r'\[([^\[\]\s]*)\s([^\[\]]*)\]', re.UNICODE) RE_LINK_EXTERNAL = re.compile(r'(?<!\[)\[[^\[\]]*\](?!\])', re.UNICODE) RE_INTERPROJECT = re.compile(r'<span class="interProject">.*?</span>', re.UNICODE)
def _createSectionRegex(min_level, headers): template = r''' (?:^|\r|\n|\r\n) ={%(min_level)d,} (?:\{\{)? (%(headers)s) (?:\}\})? ={%(min_level)d,} \s*? (?:^|\r|\n|\r\n) (.*?) (?:(?=(?:^|\r|\n|\r\n)=)|$) ''' headers = '|'.join(re.escape(i) for i in headers) return re.compile(template % locals(), re.VERBOSE | re.UNICOD...
libkerrighed.krg_nodes_add(node_set)
libkerrighed.krg_nodes_add(node_set.c)
def krg_nodes_add(node_set): """ """ libkerrighed.krg_nodes_add(node_set)
for net in ('synop', 'noaa'):
for net in ('synop', 'temp'):
def setUp(self): # We want a predictable dataset random.seed(1) rattr = random.Random() rattr.seed(1)
self.assertEquals(set(data.dims[1]), set(((200, "noaa"), (1, "synop"))))
self.assertEquals(set(data.dims[1]), set(((3, "temp"), (1, "synop"))))
def testAnaNetwork(self): # Ana in one dimension, network in the other query = dballe.Record() query.set("var", "B10004") query.setdate(datetime(2007, 1, 1, 0, 0, 0)) vars = read(self.db.query(query), (AnaIndex(), NetworkIndex())) self.assertEquals(len(vars), 1) self.assertEquals(vars.keys(), ["B10004"]) data = vars["B...
self.assertEquals(set(data.dims[2]), set(((200, "noaa"), (1, "synop"))))
self.assertEquals(set(data.dims[2]), set(((3, "temp"), (1, "synop"))))
def testAnaTrangeNetwork(self): # 3 dimensions: ana, timerange, network # 2 variables query = dballe.Record() query.setdate(datetime(2007, 1, 1, 0, 0, 0)) vars = read(self.db.query(query), (AnaIndex(), TimeRangeIndex(shared=False), NetworkIndex())) self.assertEquals(len(vars), 2) self.assertEquals(sorted(vars.keys()), ...
for net, a in ('synop', 'B33007'), ('noaa', 'B33040'):
for net, a in ('synop', 'B33007'), ('temp', 'B33040'):
def testAttrs(self): # Same export as testAnaNetwork, but check that the # attributes are synchronised query = dballe.Record() query.set("var", "B10004") query.setdate(datetime(2007, 1, 1, 0, 0, 0)) vars = read(self.db.query(query), (AnaIndex(), NetworkIndex()), attributes=True) self.assertEquals(len(vars), 1) self.ass...
if n[1] == "noaa":
if n[1] == "temp":
def testSomeAttrs(self): # Same export as testAnaNetwork, but check that the # attributes are synchronised query = dballe.Record() query.set("var", "B10004") query.setdate(datetime(2007, 1, 1, 0, 0, 0)) vars = read(self.db.query(query), (AnaIndex(), NetworkIndex()), attributes=('B33040',)) self.assertEquals(len(vars), ...
print "IK", rec["level"]
def _indexKey(self, rec): print "IK", rec["level"] return rec["level"]
_confifgure_galaxy_env()
_configure_galaxy_env()
def _configure_environment(): _configure_ec2_autorun() _clean_rabbitmq_env() _configure_sge() _confifgure_galaxy_env() _configure_nfs() _configure_bash()
def _confifgure_galaxy_env():
def _configure_galaxy_env():
def _confifgure_galaxy_env(): # Edit the galaxy user .bash_profile in a somewhat roundabout way append('export TEMP=/mnt/galaxyData/tmp', '/home/galaxy/.bash_profile', use_sudo=True) sudo('chown galaxy:galaxy /home/galaxy/.bash_profile') # Create .sge_request file in galaxy home. This will be needed for proper executio...
vol_size = 2
vol_size = 15
def rebundle(): """ Rebundles the EC2 instance that is passed as the -H parameter This script handles all aspects of the rebundling process and is (almost) fully automated. Two things should be edited and provided before invoking it: AWS account information and the desired size of the root volume for the new instance. ...
pkg_name = 'fastx'
pkg_name = 'fastx_toolkit'
def _install_fastx_toolkit(): version = "0.0.13" gtext_version = "0.6" url_base = "http://hannonlab.cshl.edu/fastx_toolkit/" fastx_url = "%sfastx_toolkit-%s.tar.bz2" % (url_base, version) gtext_url = "%slibgtextutils-%s.tar.bz2" % (url_base, gtext_version) pkg_name = 'fastx' install_dir = os.path.join(env.install_dir, ...
print "----- FASTX %s installed to %s -----" % (version, install_dir)
sudo("echo 'PATH=%s/bin:$PATH' > %s/env.sh" % (install_dir, install_dir)) sudo("chmod +x %s/env.sh" % install_dir) install_dir_root = os.path.join(env.install_dir, pkg_name) sudo('if [ ! -d %s/default ]; then ln -s %s %s/default; fi' % (install_dir_root, install_dir, install_dir_root)) print "----- FASTX Toolkit %s ins...
def _install_fastx_toolkit(): version = "0.0.13" gtext_version = "0.6" url_base = "http://hannonlab.cshl.edu/fastx_toolkit/" fastx_url = "%sfastx_toolkit-%s.tar.bz2" % (url_base, version) gtext_url = "%slibgtextutils-%s.tar.bz2" % (url_base, gtext_version) pkg_name = 'fastx' install_dir = os.path.join(env.install_dir, ...
_reboot(ec2_conn, instance_id)
if _reboot(ec2_conn, instance_id): return False image_id = None
def rebundle(): """ Rebundles the EC2 instance that is passed as the -H parameter This script handles all aspects of the rebundling process and is (almost) fully automated. Two things should be edited and provided before invoking it: AWS account information and the desired size of the root volume for the new instance. ...
print "--------------------------"
print "\n--------------------------"
def _reboot(ec2_conn, instance_id, force=False): """ Reboot current instance if required. Reboot can be forced by setting the method's 'force' parameter to True. """ if force or exists("/var/run/reboot-required"): answer = confirm("Before rebundling, instance '%s' needs to be rebooted and this script invoked again. Reb...
print "This script will exit now. Invoke it again passing method name 'rebundle' as the last argument to the fab script." print "--------------------------" time_end = dt.datetime.utcnow() print "Script existing at time %s" % str(time_end) sys.exit(0)
print "This script will exit now. Invoke it again while passing method name 'rebundle' as the last argument to the fab script." print "--------------------------\n" return True
def _reboot(ec2_conn, instance_id, force=False): """ Reboot current instance if required. Reboot can be forced by setting the method's 'force' parameter to True. """ if force or exists("/var/run/reboot-required"): answer = confirm("Before rebundling, instance '%s' needs to be rebooted and this script invoked again. Reb...
return False
return True
def _reboot(ec2_conn, instance_id, force=False): """ Reboot current instance if required. Reboot can be forced by setting the method's 'force' parameter to True. """ if force or exists("/var/run/reboot-required"): answer = confirm("Before rebundling, instance '%s' needs to be rebooted and this script invoked again. Reb...
common.loggedCmd(["wineprefixcreate", "-w", "--prefix", wineprefix], cwd=wineprefix, env=env, logger=getLog())
common.loggedCmd(["wineprefixcreate", "-w", "--prefix", wineprefix], cwd=wineprefix, env=env, logger=getLog(), raiseExc=False)
def setupWine(): getLog(prefix="verbose.").info("Running pre-setup for wine.") global wineprefix wineprefix = tempfile.mkdtemp(prefix="wineprefix-") env={ "DISPLAY":"", "TERM":"", "PATH":os.environ["PATH"], "HOME":os.environ["HOME"], "WINEPREFIX": wineprefix, } common.loggedCmd(["wineprefixcreate", "-w", "--prefix", wi...
common.loggedCmd(["wineprefixcreate", "-w", "--prefix", wineprefix], cwd=wineprefix, env=env, logger=getLog(), raiseExc=False)
if os.path.exists('/usr/bin/wineboot'): cmd = ["wineboot", "-u"] elif os.path.exists('/usr/bin/wineprefixcreate'): cmd = ["wineprefixcreate", "-w", "--prefix", wineprefix] common.loggedCmd(cmd, cwd=wineprefix, env=env, logger=getLog(), raiseExc=False)
def setupWine(): getLog(prefix="verbose.").info("Running pre-setup for wine.") global wineprefix wineprefix = tempfile.mkdtemp(prefix="wineprefix-") env={ "DISPLAY":"", "TERM":"", "PATH":os.environ["PATH"], "HOME":os.environ["HOME"], "WINEPREFIX": wineprefix, } common.loggedCmd(["wineprefixcreate", "-w", "--prefix", wi...
new_ring=global_ring()
def other_ordering_pre(I,option_set,kwds): main_kwds=kwds options=option_set ocode=get_order_code() old_ring=global_ring() try: change_ordering(options["switch_to"]) new_ring=global_ring() kwds=dict((k,options[k]) for k in options if not (k in ("other_ordering_first","switch_to","I"))) kwds["redsb"]=True I_orig=I I=gro...
I=groebner_basis(I,**kwds)
I=groebner_basis([new_ring.coerce(poly) for poly in I],**kwds)
def other_ordering_pre(I,option_set,kwds): main_kwds=kwds options=option_set ocode=get_order_code() old_ring=global_ring() try: change_ordering(options["switch_to"]) new_ring=global_ring() kwds=dict((k,options[k]) for k in options if not (k in ("other_ordering_first","switch_to","I"))) kwds["redsb"]=True I_orig=I I=gro...
assert (ocode in [OrderCode.lp, OrderCode.dlex, OrderCode.dp_asc]), ("Unsupported ordering in other_ordering_pre!") change_ordering(ocode)
def other_ordering_pre(I,option_set,kwds): main_kwds=kwds options=option_set ocode=get_order_code() old_ring=global_ring() try: change_ordering(options["switch_to"]) new_ring=global_ring() kwds=dict((k,options[k]) for k in options if not (k in ("other_ordering_first","switch_to","I"))) kwds["redsb"]=True I_orig=I I=gro...
res=substitute_variables(map_from_vec, p)
res=substitute_variables(to_ring, map_from_vec, p)
def map_from(p): res=substitute_variables(map_from_vec, p) #assert str(p)==str(res), (str(p), str(res), list(map_from_vec), list(map_back_vec)) return res
return substitute_variables(map_back_vec, p)
return substitute_variables(from_ring, map_back_vec, p)
def map_back(p): return substitute_variables(map_back_vec, p)
self.media = self.dbstate.db.get_object_from_handle(handle) self._get_image(self.media) self.update_widgets() def main(self): """ Does Nothing """ pass def update_widgets(self): """ update the image exif Metadata """ if self.media is None: return image_descr = self.media.get_description() if not image_descr: ima...
self.media = self.dbstate.db.get_object_from_handle( handle ) self.mime_type = self.media.get_mime_type() if self.mime_type: if self.mime_type.startswith("image/"): self._get_image( self.media ) image_descr = self.media.get_description() if not image_descr: image_descr = self.media.get_path() self.exif_widgets["A...
def media_changed(self, handle): """ handles when an image has been changed
def _get_media(self, media_id): """ returns an image object from the database """ if not media_id: return None media = self.dbstate.db.get_object_from_gramps_id(media_id) return media
def _get_media(self, media_id): """ returns an image object from the database """
WarningDialog(_("The image file %s does NOT have read access/ permissions. " "If you have access and rights to change the permissions, " "then please do it now." % basename))
WarningDialog(_("The image file %(filename)s does NOT have read access/ " "permissions. If you have access and rights to change " "the permissions, then please do it now.")) % { 'filename' : basename}
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
WarningDialog(_("The image file is missing. Please select another image or " "edit the media object to fix this problem."))
WarningDialog(_("The image file %(filename)s is missing. Please select another image or " "edit the media object to fix this problem.")) % {'filename' : basename}
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
def get_or_create_source(self, source_text): source_list = self.dbstate.db.get_source_handles() for source_handle in source_list: source = self.dbstate.db.get_source_from_handle(source_handle) if source.get_title() == source_text: return (0, source) source = gen.lib.Source() source.set_title(source_text) self.dbstate.d...
def get_last_source_title(self, obj): if obj: ref_list = obj.get_source_references() if len(ref_list) > 0: ref = ref_list[-1] if ref: source = self.dbstate.db.get_source_from_handle(ref.ref) if source: return source.get_title() return ""
if source_text:
if source_text and self.de_widgets["Active person:Show sources"].get_active():
def save_data_edit(self, obj): if self._dirty: # Save the edits ---------------------------------- person = self._dirty_person # First, get the data: gender = self.de_widgets["APGender"].get_active() if "," in self.de_widgets["APName"].get_text(): surname, firstname = self.de_widgets["APName"].get_text().split(",", 1) ...
if source_text:
if source_text and self.de_widgets["Active person:Show sources"].get_active():
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
if birth_event:
if death_event:
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
self.dbstate.db.add_person(person, self.trans)
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
pass
current_person = None
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
self.dbstate.db.commit_person(person, self.trans)
self.dbstate.db.add_person(person, self.trans)
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
current_person = self.dbstate.get_active_object("Person")
current_person = self.get_active_object("Person")
def add_data_entry(self, obj): from QuestionDialog import ErrorDialog # First, get the data: if "," in self.de_widgets["NPName"].get_text(): surname, firstname = self.de_widgets["NPName"].get_text().split(",", 1) else: surname, firstname = self.de_widgets["NPName"].get_text(), "" surname = surname.strip() firstname = f...
self.type_list = EnumeratedListOption(_("Split view"),
self.view_list = EnumeratedListOption(_("Split view"),
def split_panel(self, configdialog): orientation = self.gramplet_pane.pane_orientation table = gtk.Table(3, 2) table.set_border_width(12) table.set_col_spacings(6) table.set_row_spacings(6)
self.type_list.add_item(item[0], item[1])
self.view_list.add_item(item[0], item[1])
def split_panel(self, configdialog): orientation = self.gramplet_pane.pane_orientation table = gtk.Table(3, 2) table.set_border_width(12) table.set_col_spacings(6) table.set_row_spacings(6)
self.type_widget, option = make_gui_option(self.type_list,
type_widget, option = make_gui_option(self.view_list,
def split_panel(self, configdialog): orientation = self.gramplet_pane.pane_orientation table = gtk.Table(3, 2) table.set_border_width(12) table.set_col_spacings(6) table.set_row_spacings(6)
self.type_widget.value_changed = self.update_settings table.attach(self.type_widget, 1, 4, 5, 6, yoptions=0)
type_widget.value_changed = self.update_settings table.attach(type_widget, 1, 4, 5, 6, yoptions=0)
def split_panel(self, configdialog): orientation = self.gramplet_pane.pane_orientation table = gtk.Table(3, 2) table.set_border_width(12) table.set_col_spacings(6) table.set_row_spacings(6)
self.change_orientation(self.type_list.get_value())
self.change_orientation(self.view_list.get_value())
def update_settings(self): self.change_orientation(self.type_list.get_value())
src_handle = EnumeratedListOption(_('Source'), sources[0][0])
if len(sources) > 0: if len(sources[0]) > 0: default = sources[0][0] src_handle = EnumeratedListOption(_('Source'), default)
def add_menu_options(self, menu): """ Add options to the menu for the ancestor report. """ category_name = _("Report Options") report_type = EnumeratedListOption(_('Census Selection'), TYPE_PERSON) report_type.add_item(TYPE_PERSON, _('By Person')) report_type.add_item(TYPE_SOURCE, _('By Source')) report_type.add_item(...
rel_calc = PluginManager.get_instance().get_relationship_calculator()
rel_calc = Relationship.get_relationship_calculator()
def run(database, document, person): sdoc = SimpleDoc(document) name = gen.display.name.displayer.display(person) death_date = _get_date(database, person.get_death_ref()) sdoc.title(_("Number of %s's descendants") % name) sdoc.paragraph("") total = [] seen = [] outlived = [] alive = [] handles = [] _cou...
h = self.__get_font_height(style_name) y += h * 0.15
def __draw_box(self, text, color, color_count, generation, top, height):
y += h * 1.05
y += self.__get_font_height(style_name) * 1.2
def __draw_box(self, text, color, color_count, generation, top, height):
self.latitude = "" self.longitude = ""
def init(self): """ sets up the variables, widgets, and data fields """ self.exif_column_width = 15 self.dirty = False self.exif_widgets = {} self.xmp_widgets = {} self.latitude = "" self.longitude = ""
if "Exif." in keytag:
if "Exif" in keytag:
def set_value(self, keytag, KeyValue): """ sets the value for the Exif keys
elif "Xmp." in keytag:
elif "Xmp" in keytag:
def set_value(self, keytag, KeyValue): """ sets the value for the Exif keys
if self.latitude:
latitude = self.exif_widgets["Latitude"].get_text() if latitude:
def write_image_metadata(self, obj): """ saves the data fields to the image """
if "." in self.latitude: degrees, minutes, seconds, latref = self.Convert_Decimal_DDMMSS( self.latitude, "Latitude" ) self.latitude = "%(deg)s %(mins)s %(secs)s" % {
if "." in latitude: degrees, minutes, seconds, latref = self.Convert_Decimal_DDMMSS( latitude, "Latitude" ) latitude = "%(deg)s %(mins)s %(secs)s" % {
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.latitude = coords_to_rational( self.latitude )
self.exif_widgets["Latitude"].set_text( latitude ) self.exif_widgets["LatitudeRef"].set_active( latref ) latitude = coords_to_rational( latitude )
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.latitude = coords_to_rational( self.latitude ) latref = self.exif_widgets["LatitudeRef"].get_active()
latitude = coords_to_rational( latitude ) latref = self.exif_widgets["LatitudeRef"].get_active()
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.set_value( ImageLatitude, self.latitude )
self.set_value( ImageLatitude, latitude )
def write_image_metadata(self, obj): """ saves the data fields to the image """
if self.longitude:
longitude = self.exif_widgets["Longitude"].get_text() if longitude:
def write_image_metadata(self, obj): """ saves the data fields to the image """
if "." in self.longitude: degrees, minutes, seconds, longref = self.Convert_Decimal_DDMMSS( self.longitude, "Longitude" ) self.longitude = "%(deg)s %(mins)s %(secs)s" % {
if "." in longitude: degrees, minutes, seconds, longref = self.Convert_Decimal_DDMMSS( longitude, "Longitude" ) longitude = "%(deg)s %(mins)s %(secs)s" % {
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.longitude = coords_to_rational( self.longitude )
self.exif_widgets["Longitude"].set_text( longitude ) self.exif_widgets["LongitudeRef"].set_active( longref ) longitude = coords_to_rational( longitude )
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.longitude = coords_to_rational( self.longitude ) longref = self.exif_widgets["LongitudeRef"].get_active()
longitude = coords_to_rational( longitude ) longref = self.exif_widgets["LongitudeRef"].get_active()
def write_image_metadata(self, obj): """ saves the data fields to the image """
self.set_value( ImageLongitude, self.longitude )
self.set_value( ImageLongitude, longitude )
def write_image_metadata(self, obj): """ saves the data fields to the image """
ErrorDialog(_("The image file %s does NOT have write access/ permissions. " "If you have access and rights to change the permissions, " "then please do it now." % basename))
LOG.warn(_("The image file %s does NOT have write access/ permissions. " "If you have access and rights to change the permissions, " "then please do it now." % basename))
def write_image_metadata(self, obj): """ saves the data fields to the image """
latitude = self.get_value( ImageLatitude )
latitude = self.get_value( keytag )
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
degrees, minutes, seconds = latitude.split(" ", 2) degrees, rest = degrees.split("/", 1) minutes, rest = minutes.split("/", 1) seconds, rest = seconds.split("/", 1)
degrees, minutes, seconds = latitude.split(" ") degrees, rest = degrees.split("/") minutes, rest = minutes.split("/") seconds, rest = seconds.split("/")
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
'deg' : degrees, 'mins' : minutes, 'sec' : seconds} disp_lat = "%(deg)s° %(mins)s′ %(sec)s″" % { 'deg' : degrees, 'mins' : minutes, 'sec' : seconds}
'deg' : degrees, 'mins' : minutes, 'sec' : seconds }
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
else: self.exif_widgets["Latitude"].set_text("") self.exif_widgets["LatitudeRef"].set_active(0) self.Latitude = self.exif_widgets["Latitude"].get_text()
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
longitude = self.get_value( ImageLongitude )
longitude = self.get_value( keytag )
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
degrees, minutes, seconds = longitude.split(" ", 2) degrees, rest = degrees.split("/", 1) minutes, rest = minutes.split("/", 1) seconds, rest = seconds.split("/", 1)
degrees, minutes, seconds = longitude.split(" ") degrees, rest = degrees.split("/") minutes, rest = minutes.split("/") seconds, rest = seconds.split("/")
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
else: self.exif_widgets["Longitude"].set_text("") self.exif_widgets["LongitudeRef"].set_active(0) self.longitude = self.exif_widgets["Longitude"].get_text()
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
subject += word + "," self.xmp_widgets["Subject"].set_text(subject)
subject += word if index is not len(keywords): subject += "," self.xmp_widgets["Subject"].set_text( subject )
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
ErrorDialog(_("The image file %s does NOT have read access/ permissions. " "If you have access and rights to change the permissions, " "then please do it now." % basename))
LOG.warn(_("The image file %s does NOT have read access/ permissions. " "If you have access and rights to change the permissions, " "then please do it now." % basename))
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
OkDialog(_("The image file is missing. Please select another image or "
LOG.warn(_("The image file is missing. Please select another image or "
def read_image_metadata(self, obj): """ reads the image metadata after the pyexiv2.Image has been created """
coordinates = "%(deg)s° %(mins)s′ %(sec)s″" % { 'deg' : degrees, 'mins' : minutes, 'sec' : seconds} self.exif_widgets[CoordinateType].set_text(coordinates) self.exif_widgets["%sRef" % CoordinateType].set_active(CoordinateRef)
def Convert_Decimal_DDMMSS(self, Coordinates, CoordinateType): """ Converts Decimal GPS Coordinates to Degrees, Minutes, Seconds GPS Coordinates
elif "." not in Coordinates: OkDialog(_("There are no Decimal GPS Coordinates available. It must be in " "Degrees, Minutes, Seconds format already."))
def convert_latitude(self, Coordinates, CoordinateType): if Coordinates and "." in Coordinates: degrees, minutes, seconds, latref = self.Convert_Decimal_DDMMSS(Coordinates, CoordinateType) latitude = "%(deg)s %(mins)s %(sec)s" % { 'deg' : degrees, 'mins' : minutes, 'sec' : seconds } self.exif_widgets["Latitude"].set_t...
def Convert_Decimal_DDMMSS(self, Coordinates, CoordinateType): """ Converts Decimal GPS Coordinates to Degrees, Minutes, Seconds GPS Coordinates
def convert_latitude(self, Coordinates, CoordinateType): degrees, minutes, seconds, latref = self.Convert_Decimal_DDMMSS(Coordinates, CoordinateType) self.latitude = "%(deg)s %(mins)s %(sec)s" % { 'deg' : degrees, 'mins' : minutes, 'sec' : seconds } def convert_longitude(self, Coordinates, CoordinateType): degrees, ...
def convert_latitude(self, Coordinates, CoordinateType):
father = self.database.get_person_from_handle(father_handle) family_name = father.get_primary_name().get_surname()
if father_handle is not None: father = self.database.get_person_from_handle(father_handle) father_surname = father.get_primary_name().get_surname() else: father_surname = _UNKNOWN_FAMILY mother_handle = family.get_mother_handle() if mother_handle is not None: mother = self.database.get_person_from_handle(mother_handle)...
def write_family(self): handles = sorted(self.database.get_family_handles(), key=self._getFamilyTimestamp)
return True
def on_button_press(self, widget, event): from gui.editors import (EditPerson, EditEvent, EditFamily, EditSource, EditPlace, EditRepository, EditNote, EditMedia) # Here we intercept mouse clicks on selected items so that we can # drag multiple items without the click selecting only one target = self.get_path_at_pos(int...