本文整理汇总了Python中settings.Settings.get_settings方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.get_settings方法的具体用法?Python Settings.get_settings怎么用?Python Settings.get_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类settings.Settings
的用法示例。
在下文中一共展示了Settings.get_settings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: csv_filename
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def csv_filename(self):
done_or_received = 'hechos' if self.done_rb.get_active() else 'recibidos'
name = 'pagos_%s_entre_%s_y_%s' % (done_or_received, self.get_from().strftime(Settings.get_settings().date_format), self.get_to().strftime(Settings.get_settings().date_format))
u = self.get_selected_user()
k = self.get_selected_klass_or_package()
if u is not None: name += '_alumno_%s' % str_to_filename(u.to_label())
if k is not None: name += '_clase_%s' % str_to_filename(k.name)
return name+'.csv'
示例2: __init__
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def __init__(self, liability):
FormFor.__init__(self, liability)
self.fields = gtk.VBox()
self.add_field('date', attrs=10)
self.date_e.set_text(liability.date.strftime(Settings.get_settings().date_format))
self.date_e.connect('button-press-event', self.show_calendar)
self.add_field('amount', attrs=15)
self.add_field('description', attrs=100)
self.pack_start(self.fields, False)
示例3: __init__
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def __init__(self, installment):
gtk.Dialog.__init__(self, 'Editar pagos de cuota', None,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT | gtk.DIALOG_NO_SEPARATOR,
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
self.installment = installment
self.payments = {}
hbox = gtk.HBox()
self.vbox.pack_start(hbox)
dates_vbox = gtk.VBox()
hbox.pack_start(dates_vbox)
dates_vbox.pack_start(gtk.Label('Fecha'))
descs_vbox = gtk.VBox()
hbox.pack_start(descs_vbox)
descs_vbox.pack_start(gtk.Label('Descripción'))
amounts_vbox = gtk.VBox()
hbox.pack_start(amounts_vbox)
amounts_vbox.pack_start(gtk.Label('Monto'))
removes_vbox = gtk.VBox()
hbox.pack_start(removes_vbox)
removes_vbox.pack_start(gtk.Label('Eliminar'))
for p in installment.payments:
hbox = gtk.HBox()
date_e = gtk.Entry(10)
date_e.set_text(p.date.strftime(Settings.get_settings().date_format))
dates_vbox.pack_start(date_e)
desc_e = gtk.Entry(100)
if p._description: desc_e.set_text(p._description)
descs_vbox.pack_start(desc_e)
amount_e = gtk.Entry(10)
amount_e.set_text(str(p.amount))
amounts_vbox.pack_start(amount_e)
receipt_e = gtk.Entry(10)
if p._receipt_number: receipt_e.set_text(str(p._receipt_number))
#hbox.pack_start(receipt_e)
remove_e = gtk.CheckButton()
removes_vbox.pack_start(remove_e)
self.payments[p.id] = {'date': date_e, 'desc': desc_e, 'amount': amount_e, 'receipt': receipt_e, 'remove': remove_e}
self.show_all()
示例4: setUp
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def setUp(self):
self.genome_db = genome_database.GenomeDB()
s = Settings.get_settings('../config/cge-dev.cfg')
logger = Settings.init_logger(s)
conn = MySQLdb.connect( **s['mysql_genome_sync'] )
curs = conn.cursor()
curs.execute('TRUNCATE genome')
curs.execute('TRUNCATE bioproject')
curs.close()
conn.close()
self.genome_db.connect(**s['mysql_genome_sync'])
示例5: get_hours_fee
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def get_hours_fee(self):
hours = 0
fixed_fee = 0
for klass in self.klasses:
if klass.normal_fee > 0:
fixed_fee += int(klass.normal_fee)
else:
hours += klass.get_duration()
if hours == int(hours): hours = int(hours)
hours_fee = Settings.get_settings().get_fee_for(str(hours)) if hours > 0 else 0
return str(hours_fee+fixed_fee)
示例6: to_html
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def to_html(self):
title = "<h1>Movimientos del día %s</h1>" % self.get_date().strftime(Settings.get_settings().date_format)
rows = map(lambda p: list(self.p_to_row(p))[1:-1], self.payments)
caption = self.payment_totals(self.payments)
p_table = exporter.html_table(self.payment_headings,rows,caption)
rows = map(lambda m: list(self.m_to_row(m))[1:], self.movements)
caption = self.movement_totals(self.movements)
m_table = exporter.html_table(self.movement_headings,rows,caption)
return exporter.html_wrapper(title+"<div style='float:left;width:49%;min_width:400px;'>Pagos:"+p_table+"</div><div style='float:right;width:49%;min_width:400px;'>Movimientos:"+m_table+"</div><div class='clear'></div>")
示例7: on_klass_toggled
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def on_klass_toggled(self, check):
hours = 0
fixed_fee_klasses = []
for sch in self.get_checked_schedules():
if int(sch.klass.normal_fee) > 0:
if not [k for k in fixed_fee_klasses if k.id == sch.klass.id]:
fixed_fee_klasses.append(sch.klass)
else:
hours += sch.duration()
if hours == int(hours): hours = int(hours)
hours_fee = Settings.get_settings().get_fee_for(str(hours)) if hours > 0 else 0
fixed_fee = sum(map((lambda k: k.normal_fee), fixed_fee_klasses))
self.fee_e.set_text(str(hours_fee+fixed_fee))
示例8: __init__
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def __init__(self, movement):
FormFor.__init__(self, movement)
self.fields = gtk.VBox()
self.add_field('date', attrs=10)
self.date_e.set_text(movement.date.strftime(Settings.get_settings().date_format))
self.date_e.connect('button-press-event', self.show_calendar)
self.add_field('amount', attrs=15)
self.add_field('description', attrs=100)
self.direction = gtk.HBox(True, 2)
self.incoming_r = gtk.RadioButton(None, 'Entrada')
self.outgoing_r = gtk.RadioButton(self.incoming_r, 'Salida')
self.direction.pack_start(self.incoming_r)
self.direction.pack_start(self.outgoing_r)
self.fields.pack_start(self.direction,False)
self.pack_start(self.fields, False)
示例9: __init__
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def __init__(self):
gtk.Window.__init__(self,gtk.WINDOW_TOPLEVEL)
self.menu = MainMenu()
self.v_box = gtk.VBox()
self.add(self.v_box)
self.v_box.pack_start(self.menu, False)
self.notebook = gtk.Notebook()
self.notebook.set_scrollable(True)
settings = Settings.get_settings()
pos = gtk.POS_TOP if settings.tabs_position == 'top' else gtk.POS_LEFT
self.notebook.set_tab_pos(pos)
self.v_box.pack_start(self.notebook, True)
self.statusbar = gtk.Statusbar()
self.statusbar_timer = None
self.v_box.pack_end(self.statusbar, False)
示例10: update_taxonomy
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def update_taxonomy():
s = Settings.get_settings('../config/cge-dev.cfg')
logger = Settings.init_logger(s)
logger.info('Beginning taxonomy lookup')
conn = MySQLdb.connect( **s['mysql_genome_sync'] )
curs = conn.cursor()
statement = """SELECT bioproject_id FROM genome WHERE tax_id IS NULL"""
res = curs.execute(statement)
id_list = curs.fetchall()
logger.info('Found %i taxonomies to lookup', len( id_list ))
#id_list = id_list[1:50] #test
id_tax = lookup_taxonomy(logger, id_list, s['entrez']['email'])
logger.info('Looked up %i taxonomies', len( id_tax ))
update_statement = """UPDATE genome SET tax_id = %s WHERE bioproject_id = %s"""
tax_id = [(tax, id) for id, tax in id_tax]
res = curs.executemany(update_statement, tax_id)
conn.commit()
logger.info('Finished updating taxonomies')
示例11: syncronize
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def syncronize():
parser = argparse.ArgumentParser(description="Synchronize NCBI Genomes with Database")
parser.add_argument('-c', '--config',help='Use the specified settings file', default='../config/cge-dev.cfg')
args = parser.parse_args()
s = Settings.get_settings( args.config )
logger = Settings.init_logger(s)
logger.info('Beginning Genome Sync')
ftp_settings = s['ftp_ncbi']
old_filename = ftp_settings['saveas'] + '.old'
if( os.path.exists( ftp_settings['saveas'] ) ):
os.rename( ftp_settings['saveas'], old_filename )
ftp = FTP_Get(logger.getChild('NCBI-FTP'))
ftp.connect(host=ftp_settings['host'],
user=ftp_settings['user'],
passwd=ftp_settings['passwd'],
acct=ftp_settings['acct'],
timeout=ftp_settings['timeout'])
csv_file = None
if(ftp_settings.get('dirname',None)):
ftp.cwd( ftp_settings['dirname'] )
try:
csv_file = ftp.getFile( ftp_settings['filename'], ftp_settings['saveas'])
ftp.close()
except Exception, e:
if( csv_file ):
csv_file.close()
if( os.path.exists( ftp_settings['saveas'] ) ):
os.remove( ftp_settings['saveas'] )
logger.error('Error durring FTP download of %s' % ftp_settings['filename'])
logger.debug( e.message )
logger.info( 'Using Old FTP File instead' )
if( os.path.exists( old_filename )):
csv_file = open( old_filename, 'rb' )
示例12: setUp
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def setUp(self):
s = Settings.get_settings('../config/cge-dev.cfg')
logger = Settings.init_logger(s)
self.__gbk_mysql = replicon_database.RepliconDB(logger.getChild('TestRepliconDB'))
self.__gbk_mysql.connect( **s['mysql_replicon'] )
示例13: __init__
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def __init__(self, payments, movements):
self.movements = movements
self.payments = payments
gtk.VBox.__init__(self, False, 5)
content = gtk.HBox()
self.pack_start(content, True)
self.date = gtk.Entry(10)
self.date.set_text(datetime.datetime.today().strftime(Settings.get_settings().date_format))
self.date.connect('button-press-event', self.show_calendar)
self.date.set_property("editable", False)
self.date.set_can_focus(False)
self.filter = gtk.Button('Buscar')
self.desc_filter = gtk.Entry(100)
self.desc_filter.connect('changed', self.on_desc_filter_changed)
self.form = gtk.VBox(False, 5)
label = gtk.Label()
label.set_markup('<big><b>Filtrar:</b></big>')
self.form.pack_start(label, False)
self.form.pack_start(gtk.Label('Fecha:'), False)
self.form.pack_start(self.date, False)
self.form.pack_start(gtk.Label('Buscar:'), False)
self.form.pack_start(self.desc_filter, False)
self.form.pack_start(self.filter, False)
self.since_closer = gtk.CheckButton('Sólo desde cierre')
self.mark_closers = gtk.Button('Marcar cierre')
self.form.pack_start(self.since_closer, False)
self.form.pack_start(self.mark_closers, False)
content.pack_start(self.form, False)
self.tables = gtk.HBox(True, 6)
p_table = gtk.VBox()
self.payment_headings = ['Detalle', 'Entrada', 'Salida', 'Alumno/Profesor']
self.p_list = PaymentsList(payments, self.payment_headings, self.p_to_row, False)
self.p_list.connect('row-activated', self.on_payment_row_activated)
self.p_scroll = gtk.ScrolledWindow()
self.p_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.p_scroll.add(self.p_list)
p_table.pack_start(self.p_scroll, True)
total_p_hbox = gtk.HBox()
self.total_p_label = gtk.Label(self.payment_totals(payments))
total_p_hbox.pack_start(self.total_p_label, False)
p_table.pack_start(total_p_hbox, False)
self.tables.pack_start(p_table)
m_table = gtk.VBox()
self.movement_headings = ['Detalle', 'Entrada', 'Salida']
self.m_list = MovementsList(movements, self.movement_headings, self.m_to_row)
self.m_scroll = gtk.ScrolledWindow()
self.m_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.m_scroll.add(self.m_list)
m_table.pack_start(self.m_scroll, True)
total_m_hbox = gtk.HBox()
self.total_m_label = gtk.Label(self.movement_totals(movements))
total_m_hbox.pack_start(self.total_m_label, False)
m_table.pack_start(total_m_hbox, False)
self.tables.pack_start(m_table)
content.pack_start(self.tables)
total_hbox = gtk.HBox()
self.total_label = gtk.Label(self.totals(payments,movements))
self.actions = gtk.HBox(False, 5)
self.export_html = gtk.Button('Exportar HTML')
self.export_csv = gtk.Button('Exportar CSV')
self.actions.pack_start(self.export_html, False)
self.actions.pack_start(self.export_csv, False)
self.actions.pack_start(gtk.HBox(), True)
self.actions.pack_start(self.total_label, False)
self.pack_start(self.actions, False)
self.show_all()
示例14: default_to_row
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def default_to_row(self, p):
return (p,p.user.to_label(),p.date.strftime(Settings.get_settings().date_format),'$'+str(p.amount), p.description, str(p.receipt_number or ''), False)
示例15: refresh
# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import get_settings [as 别名]
def refresh(self):
self.store.clear()
if self.user.is_not_new_record():
for l in self.user.get_liabilities():
self.store.append((l,l.date.strftime(Settings.get_settings().date_format), l.description, l.detailed_to_pay()))