本文整理汇总了Python中pyasm.prod.biz.ProdSetting类的典型用法代码示例。如果您正苦于以下问题:Python ProdSetting类的具体用法?Python ProdSetting怎么用?Python ProdSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProdSetting类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_reg_hours
def get_reg_hours():
# FIXME: this shold be in pyasm.biz, not pyasm.prod.biz
from pyasm.prod.biz import ProdSetting
reg_hours = ProdSetting.get_value_by_key("reg_hours")
if not reg_hours:
# auto create if it does not exist
ProdSetting.create('reg_hours', '10', 'sequence', \
description='regular work hours', search_type='sthpw/project')
return reg_hours
示例2: __init__
def __init__(self, dynamic_load=0, tab_key="tab", css=REG):
self.tab_names = []
self.wdg_dict = {}
self.dynamic_load = dynamic_load
self.set_tab_key(tab_key)
self.tab_style = css
self.content_height = 0
self.mode = Container.get("tab_mode")
# setting tab path
self.tab_path = Container.get("tab_path")
if not self.tab_path:
self.tab_path = "Main"
self.error_wdg = None
self.div = DivWdg(css='left_content')
if Environment.has_tactic_database():
self.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
else:
self.invisible_list = []
super(TabWdg,self).__init__()
示例3: __init__
def __init__(my, dynamic_load=0, tab_key="tab", css=REG):
my.tab_names = []
my.wdg_dict = {}
my.dynamic_load = dynamic_load
my.set_tab_key(tab_key)
my.tab_style = css
my.content_height = 0
my.mode = Container.get("tab_mode")
# setting tab path
my.tab_path = Container.get("tab_path")
if not my.tab_path:
my.tab_path = "Main"
my.error_wdg = None
my.div = DivWdg(css='left_content')
if Environment.has_tactic_database():
my.invisible_list = ProdSetting.get_seq_by_key('invisible_tabs')
else:
my.invisible_list = []
super(TabWdg,my).__init__()
示例4: main
def main(server=None, input=None):
"""
:param server: the TacticServerStub object
:param input: a dict with data like like search_key, search_type, sobject, and update_data
:return: None
"""
try:
from formatted_emailer import EmailDirections, email_sender
todays_date = date.today()
one_week_ago = (todays_date - timedelta(days=7)).strftime('%Y-%m-%d')
past_due_titles = server.eval("@SOBJECT(twog/title['expected_delivery_date', 'is before', '{0}']['expected_delivery_date', 'is after', '{1}'])".format(todays_date, one_week_ago))
number_of_titles_past_due = len(past_due_titles)
past_due_titles = [title.get('code') for title in past_due_titles]
email_subject = 'There are {0} Titles that are past due'.format(number_of_titles_past_due)
message = "The following titles are past due.<br/><br/>{0}<br/><br/>Please log into Tactic and change the " \
"due date on these Titles. If you don't know when that's supposed to be, you can just change it " \
"to today's date.".format(', '.join(past_due_titles))
recipients = ProdSetting.get_seq_by_key('past_due_alert_recipients')
if not recipients:
return
context_data = {
'to_email': recipients[0],
'subject': email_subject,
'message': message,
'from_email': '[email protected]',
'from_name': 'Tactic',
}
if len(recipients) > 1:
context_data.update({'ccs', ';'.join(recipients[1:])})
internal_template_file = '/opt/spt/custom/formatted_emailer/templates/past_due_title_notification.html'
if context_data['to_email']:
email_file_name = 'past_due_title_notification_{0}.html'.format(todays_date)
email_sender.send_email(template=internal_template_file, email_data=context_data,
email_file_name=email_file_name, server=server)
except AttributeError as e:
traceback.print_exc()
print str(e) + '\nMost likely the server object does not exist.'
raise e
except KeyError as e:
traceback.print_exc()
print str(e) + '\nMost likely the input dictionary does not exist.'
raise e
except Exception as e:
traceback.print_exc()
print str(e)
raise e
示例5: get_display
def get_display(my):
# just refresh the whole thing
widget = DivWdg()
outer_widget = DivWdg(css='spt_view_panel')
search_div = DivWdg()
search_bvr = {
'type': 'click_up',
'cbjs_action': 'spt.dg_table.search_cbk(evt, bvr)',
'override_class_name': 'tactic.ui.cgapp.AppShotPanelWdg',
'override_target': 'bvr.src_el.getParent(".spt_app_shot_panel")',
'extra_args': {'instance_search_type': my.instance_search_type,
'asset_search_type': my.asset_search_type}
#'panel_id': 'main_body_search'
}
# WARNING: this is made just for main search box and won't be compatible with the simple search wdg
search_wdg = SearchWdg(search_type=my.search_type, custom_search_view='search_shot_loader', parent_key='', filter=''\
, display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)
#from tactic.ui.app.simple_search_wdg import SimpleSearchWdg
#search_wdg = SimpleSearchWdg(search_type=my.search_type, search_view=my.simple_search_view, state=None, run_search_bvr=search_bvr)
search_div.add( HtmlElement.spacer_div(1,10) )
search_div.add(search_wdg)
# if there is result, it could only be one shot
search = search_wdg.get_search()
shots = search.get_sobjects()
# avoid getting a shot when no shot is selected
if not my.shot_code and len(shots) == 1:
my.shot_code = shots[0].get_code()
outer_widget.add(search_div)
my.set_as_panel(outer_widget, class_name='spt_panel spt_view_panel spt_app_shot_panel')
#show_shot_panel = False
#if show_shot_panel:
panel = ViewPanelWdg( search_type=my.search_type, \
inline_search=True, show_search='false', show_refresh='false', view=my.view, \
run_search_bvr=search_bvr, simple_search_view=my.simple_search_view)
panel.set_sobjects(shots)
widget.add(panel)
show_instances_in_shot = ProdSetting.get_value_by_key("show_instances_in_shot_panel")
if show_instances_in_shot != "false":
widget.add(HtmlElement.h3("Asset Instances in Shot [%s]" %my.shot_code))
widget.add(HtmlElement.br(2))
asset_inst_panel = AppAssetInstancePanelWdg(search_type=my.search_type, instance_search_type=my.instance_search_type, asset_search_type=my.asset_search_type, shot_code=my.shot_code, show_search='false')
widget.add(asset_inst_panel)
outer_widget.add(widget)
return outer_widget
示例6: get_sobject_base
def get_sobject_base(my, dirs):
# add <project_code>/<table>
search_type_obj = my.sobject.get_search_type_obj()
project_code = my.sobject.get_project().get_code()
dirs.append( project_code )
#db_name = search_type_obj.get_database()
#dirs.append( db_name )
from pyasm.prod.biz import ProdSetting
if project_code not in ["admin", 'sthpw']:
icon_separation = ProdSetting.get_value_by_key("use_icon_separation")
if not icon_separation:
# put in a default
icon_separation = "false"
ProdSetting.create('use_icon_separation', icon_separation, 'string',\
description='Determines whether icons are in complete separate directories')
if icon_separation == 'true':
if my.snapshot and my.snapshot.get_value("context") == "icon":
dirs.append("icon")
elif my.get_file_type() == "icon":
dirs.append("icon")
#process = my.snapshot.get_value("process")
#search_type = my.snapshot.get_value("search_type")
# add a concept of branching
# from pyasm.web import WidgetSettings
# branch = WidgetSettings.get_value_by_key("current_branch")
# #WidgetSettings.set_value_by_key("current_branch", branch)
# if branch:
# #dirs.append( "perforce" )
# dirs.append( branch )
table = search_type_obj.get_table()
dirs.append( table )
return dirs
示例7: get_context_wdg
def get_context_wdg(my, search_type):
'''drop down which selects which context to checkin'''
# add a filter
# use a regular SelectWdg with submit instead of FilterSelectWdg
filter_div = FloatDivWdg("Context / subcontext:")
select = SelectWdg("publish_context")
labels, values = my.get_context_data(search_type, my.process)
select.set_option("values", "|".join(values))
select.set_option("labels", "|".join(labels))
select.append_option('publish','publish')
select.add_style("font-size: 0.8em")
select.add_style("margin: 0px 3px")
# explicitly set the value
current = select.get_value()
if current in values:
context = current
elif values:
context = values[0]
else:
context = ""
web = WebContainer.get_web()
web.set_form_value("publish_context", context)
select.set_value( context )
# set it to a instance variable
my.context_select = select
filter_div.add(select)
# if specified, add a sub_context
base_search_type = SearchType(search_type).get_base_key()
settings = ProdSetting.get_value_by_key("%s/sub_context" % context,\
base_search_type)
filter_div.add( "/ ")
sub_context = None
if settings:
sub_context = SelectWdg("publish_sub_context")
sub_context.set_option("values", settings)
sub_context.set_submit_onchange()
sub_context.add_empty_option("<- Select ->")
else:
# provide a text field
sub_context = TextWdg("publish_sub_context")
sub_context.set_attr('size','10')
sub_context.set_persistence()
filter_div.add( sub_context )
my.sub_context_select = sub_context
#filter_div.add_style('padding-right','10px')
return filter_div
示例8: __init__
def __init__(my, **kwargs):
my.frames = kwargs.get("frames")
my.fps = kwargs.get("fps")
if not my.fps:
from pyasm.prod.biz import ProdSetting
my.fps = ProdSetting.get_value_by_key("fps")
if not my.fps:
my.fps = 24
if not my.frames:
timecode = kwargs.get("timecode")
my.frames = my.calculate_frames(timecode, my.fps)
示例9: convert_to_time
def convert_to_time(self, frames):
fps = ProdSetting.get_value_by_key("fps")
if not fps:
fps = 24
else:
fps = int(fps)
minutes = frames / (60*fps)
frames = frames - (minutes*60*fps)
seconds = frames / fps
extra = frames % fps
time = "%0.2dm:%0.2ds.%0.2d" % (minutes, seconds, extra)
return time
示例10: get_web_file_size
def get_web_file_size(my):
from pyasm.prod.biz import ProdSetting
web_file_size = ProdSetting.get_value_by_key('web_file_size')
thumb_size = (640, 480)
if web_file_size:
parts = re.split('[\Wx]+', web_file_size)
thumb_size = (640, 480)
if len(parts) == 2:
try:
thumb_size = (int(parts[0]), int(parts[1]))
except ValueError:
thumb_size = (640, 480)
return thumb_size
示例11: handle_tab
def handle_tab(self, tab):
tab.add(self.get_shot_list_wdg, _("Shot List") )
tab.add(self.get_summary_wdg, _("Summary") )
tab.add(self.get_milestone_wdg, _("Milestones") )
tab.add(MultiPlannerWdg, _("Planners") )
tab.add(self.get_task_manager_wdg, _("Tasks") )
#tab.add(ShotParentWdg, "Shot Parenting") )
tab.add(self.get_artist_wdg, _("Artist (Shots)") )
tab.add(self.get_supe_wdg, _("Supe (Shots)") )
tab.add(self.get_layer_wdg, _("Layers") )
tab.add(self.get_comp_wdg, _("Composites") )
tab.add(self.get_render_log_wdg, _("Render Log") )
tab.add(self.get_seq_wdg, _("Sequences") )
if ProdSetting.get_value_by_key('shot_hierarchy') == 'episode_sequence':
tab.add(self.get_episode_wdg, _("Episodes") )
tab.add(self.get_notes_wdg, _("Notes") )
示例12: __init__
def __init__(my, **kwargs):
my.frames = kwargs.get("frames")
my.frames = float(my.frames)
my.fps = kwargs.get("fps")
if not my.fps:
from pyasm.prod.biz import ProdSetting
my.fps = ProdSetting.get_value_by_key("fps")
my.fps = int(my.fps)
if not my.fps:
my.fps = 24
if not my.frames:
timecode = kwargs.get("timecode")
my.frames = my.calculate_frames(timecode, my.fps)
# handle cases where frames has a decimal: ie: 400.4
my.frames = int(float(my.frames))
示例13: __init__
def __init__(self, **kwargs):
self.frames = kwargs.get("frames")
self.frames = float(self.frames)
self.fps = kwargs.get("fps")
if not self.fps:
from pyasm.prod.biz import ProdSetting
self.fps = ProdSetting.get_value_by_key("fps")
self.fps = int(self.fps)
if not self.fps:
self.fps = 24
if not self.frames:
timecode = kwargs.get("timecode")
self.frames = self.calculate_frames(timecode, self.fps)
# handle cases where frames has a decimal: ie: 400.4
self.frames = int(float(self.frames))
示例14: show_platform_connection
def show_platform_connection():
"""
A short convenience function to check Tactic's Project Settings for a value called
show_platform_connection_on_hot_today, which tells the hot list whether or not to display Client-Platform
connections as part of Edel's tasks.
show_platform_connection_on_hot_today should be a string value set to either 'True' or 'False' (sadly Tactic
does not support Boolean values for ProdSettings)
:return: Boolean
"""
# Cast the value to str, just in case it returns None
show_platform_connection_string = str(ProdSetting.get_value_by_key('show_platform_connection_on_hot_today'))
if show_platform_connection_string.lower() == 'true':
return True
else:
return False
示例15: get_display
def get_display(my):
from pyasm.prod.biz import ProdSetting
my.code = str(my.kwargs.get('code'))
my.sk = str(my.kwargs.get('sk'))
my.movement_code = str(my.kwargs.get('movement_code'))
my.source_contexts = ProdSetting.get_value_by_key('source_contexts').split('|')
ms = MovementScripts(movement_code=my.movement_code)
table = Table()
table.add_attr('class','movement_twog_easy_checkin')
table.add_attr('width','100%s' % '%')
table.add_row()
title_bar = table.add_cell('<b><u>Checkin New File</u></b>')
title_bar.add_attr('align','center')
title_bar.add_attr('colspan','4')
title_bar.add_style('font-size: 110%ss' % '%')
processes_sel = SelectWdg('source_process_select')
for ctx in my.source_contexts:
processes_sel.append_option(ctx,ctx)
table.add_row()
mini0 = Table()
mini0.add_row()
mini0.add_cell('Checkin Context: ')
mini0.add_cell(processes_sel)
table.add_cell(mini0)
mini1 = Table()
mini1.add_row()
file_holder = mini1.add_cell(' ')
file_holder.add_attr('width','100%s' % '%')
file_holder.add_attr('align','center')
file_holder.add_attr('class','file_holder')
button = mini1.add_cell('<input type="button" value="Browse"/>')
button.add_attr('align','right')
button.add_style('cursor: pointer;')
button.add_behavior(ms.get_easy_checkin_browse_behavior())
big_button = mini1.add_cell('<input type="button" value="Check In" class="easy_checkin_commit" disabled/>')
big_button.add_style('cursor: pointer;')
big_button.add_behavior(ms.get_easy_checkin_commit_behavior(my.sk))
table.add_cell(mini1)
return table