def make_check_table(my, dictoid, arr, sob, sk, my_name, color): #Makes a table of checklisted items table = Table() table.add_style('background-color: %s;' % color) #The maximum width across (max number of columns of checkboxes) max_width = 3 table.add_row() top_cell = table.add_cell('<b><u>%s</u></b>' % my_name) top_cell.add_attr('colspan',max_width) top_cell.add_attr('align','center') count = 0 for entry in arr: #If it has hit the max width for the row, create a new row if count % max_width == 0: table.add_row() #Create textbox check_bool = 'false' if sob: if sob.get(dictoid[entry]): check_bool = 'true' else: check_bool = 'false' else: check_bool = 'false' checker = CustomCheckboxWdg(name='errcheck_%s_%s' % (dictoid[entry], sk),value_field=dictoid[entry],checked=check_bool,dom_class='check_table_selector',field=dictoid[entry]) check_hold = table.add_cell(checker) check_hold.add_attr('field', dictoid[entry]) label = table.add_cell(entry) label.add_attr('nowrap','nowrap') label.add_attr('width','190px') count = count + 1 return table
def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False): table = Table() table.add_style('background-color: %s;' % color) max_width = 3 table.add_row() top_cell = table.add_cell('<b><u>%s</u></b>' % my_name) top_cell.add_attr('colspan',max_width) top_cell.add_attr('align','center') count = 0 for entry in arr: if count % max_width == 0: table.add_row() checker = CheckboxWdg('check_%s' % dictoid[entry]) checker.add_attr('code', sob.get('code')) checker.add_attr('field', dictoid[entry]) #checker.set_persistence() if sob.get(dictoid[entry]): checker.set_value(True) else: checker.set_value(False) if not is_external_rejection: checker.add_behavior(my.get_reason_check_behavior(dictoid[entry])) check_hold = table.add_cell(checker) check_hold.add_attr('code', sob.get('code')) check_hold.add_attr('field', dictoid[entry]) label = table.add_cell(entry) label.add_attr('nowrap','nowrap') label.add_attr('width','190px') count = count + 1 return table
def get_display(self): self.order_sk = str(self.kwargs.get("order_sk")) self.title_code = str(self.kwargs.get("title_code")) full_title = str(self.kwargs.get("full_title")) delivs_search = Search("twog/work_order_deliverables") delivs_search.add_filter("title_code", self.title_code) delivs = delivs_search.get_sobjects() linked = [] for d in delivs: linked.append(d.get_value("satisfied")) satisfied = 0 unsatisfied = 0 for link in linked: if link == True: satisfied += 1 else: unsatisfied += 1 table = Table() table.add_row() deliverable_launcher = table.add_cell("<u>Delivs: (%s/%s)</u>" % (satisfied, satisfied + unsatisfied)) deliverable_launcher.add_attr("nowrap", "nowrap") deliverable_launcher.add_attr("valign", "bottom") deliverable_launcher.add_style("font-size: 80%;") deliverable_launcher.add_style("font-color: #2e2e2e;") deliverable_launcher.add_style("cursor: pointer;") deliverable_launcher.add_behavior(get_launch_deliverables_behavior(self.order_sk, self.title_code, full_title)) return table
def get_display(self): if self.is_refresh: top = Widget() self.add(top) web = WebContainer.get_web() self.checked_processes = web.get_form_values('process_names') left_checked_processes = web.get_form_values('left_process_names') right_checked_processes = web.get_form_values('right_process_names') is_split_view = web.get_form_values('split_view') == 'true' else: top = self.get_viewer() self.process_names = [x for x in self.process_names if x ] if self.is_refresh: if self.process_names: table = Table() table.add_row() td = table.add_cell() expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.process_names) table_id = 'main_table_left' left_table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\ show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression ) if self.resize: from tactic.ui.container import ResizeScrollWdg inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' ) inner_wdg.add(left_table) td.add(inner_wdg) else: td.add(left_table) top.add(table) return top
def __init__(self, **kwargs): self.table = Table() self.table.add_style("border-collapse: collapse") self.table.add_style("padding: 0px") self.table.set_attr("cellpadding", "0px") self.table.set_attr("cellspacing", "0px") self.is_first_row = True self.hilight = self.table.get_color("background", -40) super(ResizableTableWdg, self).__init__(**kwargs)
def get_content_wdg(my): div = DivWdg() div.add_class("spt_tool_top") table = Table() div.add(table) table.add_row() td = table.add_cell() from table_layout_wdg import FastTableLayoutWdg kwargs = my.kwargs.copy() td.add_style("width: 1%") td.add_style("vertical-align: top") layout_div = DivWdg() layout_div.add_style("min-height: 500px") td.add(layout_div) my.kwargs['element_names'] = ['name','description','detail', 'file_list','general_checkin'] my.kwargs['show_shelf'] = False layout = FastTableLayoutWdg(**my.kwargs) layout_div.add(layout) #from tactic.ui.panel import TileLayoutWdg #layout = TileLayoutWdg(**my.kwargs) #layout_div.add(layout) td = table.add_cell() td.add_border(color="#EEE") td.add_style("vertical-align: top") content = DivWdg() td.add(content) content.add_class("spt_tool_content") #content.add_style("margin: -1px") no_content_wdg = DivWdg() content.add(no_content_wdg) no_content_wdg.add("<br/>"*3) no_content_wdg.add("<i>-- No Content --</i>") #no_content_wdg.add_style("opacity: 0.5") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_color("color", "color3") no_content_wdg.add_color("background", "background3") no_content_wdg.add_style("text-align", "center") no_content_wdg.add_style("padding-top: 20px") no_content_wdg.add_style("padding-bottom: 20px") no_content_wdg.add_style("width: 350px") no_content_wdg.add_style("height: 110px") no_content_wdg.add_border() return div
def configure_category(my, title, category, options, options_type = {}): div = DivWdg() title_wdg = DivWdg() div.add(title_wdg) #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg #swap = SwapDisplayWdg() #div.add(swap) title_wdg.add("<b>%s</b>" % title) table = Table() div.add(table) #table.add_color("color", "color") table.add_style("color: #000") table.add_style("margin: 20px") for option in options: table.add_row() display_title = Common.get_display_title(option) td = table.add_cell("%s: " % display_title) td.add_style("width: 150px") option_type = options_type.get(option) validation_scheme = "" #add selectWdg for those options whose type is bool if option_type == 'bool': text = SelectWdg(name="%s/%s" % (category, option)) text.set_option('values','true|false') text.set_option('empty','true') text.add_style("margin-left: 0px") elif option.endswith('password'): text = PasswordInputWdg(name="%s/%s" % (category, option)) # dealing with options whose type is number else: if option_type == 'number': validation_scheme = 'INTEGER' else: validation_scheme = "" text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false") value = Config.get_value(category, option) if value: text.set_value(value) table.add_cell(text) return div
def get_display(my): widget = DivWdg() table = Table() table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="%s">' % my.button_image) launch_behavior = my.get_launch_behavior() cell1.add_style("cursor: pointer;") cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): xml = '' if my.client in ['Sony','sony']: xml = my.make_sony_xml() widget = DivWdg() table = Table() table.add_row() table.add_cell('<textarea cols="120" rows="50" class="xml_display" name="xml_display" disabled="disabled">%s</textarea>' % xml) widget.add(table) return widget
def get_display(my): widget = DivWdg() table = Table() order_poster = my.get_poster_img(my.code) order_poster_entry = 'None' if order_poster not in [None, '']: order_poster_entry = '<img src="%s" width="135" height="200"/>' % order_poster table.add_cell(order_poster_entry) widget.add(table) return widget
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects): """ Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes. If a file is also in the selected_file_sobjects list, check it automatically. :param file_sobjects: List of file sobjects :param selected_file_sobjects: List of file sobjects (that are already selected) :return: Table """ files_checkbox_table = Table() header_row = files_checkbox_table.add_row() header = files_checkbox_table.add_header(data='Files', row=header_row) header.add_style('text-align', 'center') header.add_style('text-decoration', 'underline') for file_sobject in file_sobjects: checkbox = CheckboxWdg(name=file_sobject.get_code()) if file_sobject.get_code() in [ selected_file.get_code() for selected_file in selected_file_sobjects ]: checkbox.set_checked() checkbox_row = files_checkbox_table.add_row() files_checkbox_table.add_cell(data=checkbox, row=checkbox_row) files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row) return files_checkbox_table
def get_display(my): import re from client.tactic_client_lib import TacticServerStub from tactic.ui.panel import FastTableLayoutWdg server = TacticServerStub.get() sk = str(my.kwargs.get('sk')) splits = sk.split('code=') search_type = splits[0].split('?')[0]; code = splits[1]; search_id = re.findall(r'\d+', code) search_id = int(search_id[0]) widget = DivWdg() table = Table() table.add_attr('class','snapshot_viewer_wdg') table.add_attr('sk',sk) #ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='table', element_names='preview,process,description,web_path,timestamp,login', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, width='100%s' % '%', show_column_manager=False, expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))", temp=True) if search_type == 'sthpw/note': expression = "@SOBJECT(sthpw/snapshot)" else: expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))" ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='snapshot_by_process', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, height='300px', width='100%s' % '%', show_column_manager=False, expression=expression, temp=True) table.add_row() table.add_cell(ftl) widget.add(table) return widget
def add_unassigned_instances(self, widget, shot_inst_names): ''' add the unassigned instances into a SwapDisplayWdg ''' info = [] session = SessionContents.get() if not session: return "" tactic_nodes = session.get_instance_names(is_tactic_node=True) non_tactic_nodes = session.get_node_names(is_tactic_node=False) """ title = HtmlElement.b('Unassigned instances') widget.add(title) # this is just a filler for now, can be any sobjects snapshots = [] for tactic_node in tactic_nodes: if tactic_node not in shot_inst_names: session_version = session.get_version(tactic_node) session_snap = session.get_snapshot(tactic_node) if session_snap: snapshots.append(session_snap) info.append({'session_version': session_version, 'instance':\ tactic_node}) div = DivWdg(id="unassigned_table") SwapDisplayWdg.create_swap_title( title, swap, div) table = TableWdg('sthpw/snapshot', 'session_items') table.set_show_property(False) table.set_aux_data(info) table.set_sobjects(snapshots) div.add(table) widget.add(div) widget.add(HtmlElement.br()) """ # Add other non-tactic nodes swap2 = SwapDisplayWdg.get_triangle_wdg() title2 = HtmlElement.b('Other Nodes') div2 = DivWdg(id="other_node_div") widget.add(swap2) widget.add(title2) SwapDisplayWdg.create_swap_title(title2, swap2, div2) hidden_table = Table(css='table') div2.add(hidden_table) hidden_table.set_max_width() for node in non_tactic_nodes: hidden_table.add_row() hidden_table.add_cell(node) hidden_table.add_blank_cell() widget.add(div2)
def get_split_viewer(self): table = Table() table.add_row() td = table.add_cell() inner_wdg = SingleNoteViewerWdg(processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name = 'left_context_cb', show_context='true', append_context=self.append_context, view=self.view) td.add(inner_wdg) td = table.add_cell() inner_wdg = SingleNoteViewerWdg(processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name = 'right_context_cb', show_context='true', append_context=self.append_context, view=self.view) td.add(inner_wdg) return table
def get_display(my): sobject = my.get_current_sobject() tcode = sobject.get_code() wo_inst = my.server.eval("@GET(twog/work_order['task_code','%s'].instructions)" % tcode) instructions = '' if len(wo_inst) > 0: if wo_inst[0] != '': instructions = '<textarea rows=8 cols=50 readonly>%s</textarea>' % wo_inst[0] table = Table() table.add_row() table.add_cell(instructions) return table
def set_dates_table(self, parent_table, client_deliver_by_date, expected_due_date): """ Sets a table showing the Client Deliver By and Expected Due Date. Both rows have a color depending on whether or not the title is past due, due today, or neither. Dates are displayed in a more human readable format. :param parent_table: The table containing the date table :param client_deliver_by_date: Timestamp in '%Y-%m-%d %H:%M:%S' format :param expected_due_date: Timestamp in '%Y-%m-%d %H:%M:%S' format :return: None """ date_row = parent_table.add_row() date_table = Table() date_table.add_style('margin', '2px 0px') client_deliver_by_date_status = get_date_status(client_deliver_by_date) expected_due_date_status = get_date_status(expected_due_date) # Get the color statuses of each date. Set to black if no status found client_deliver_by_date_status_color = self.DATE_STATUS_COLOR.get(client_deliver_by_date_status, '#000000') expected_due_date_status_color = self.DATE_STATUS_COLOR.get(expected_due_date_status, '#000000') # The tr's for our td's in the table expected_due_date_row = date_table.add_row() client_deliver_by_row = date_table.add_row() # Set the row's color client_deliver_by_row.add_style('color', client_deliver_by_date_status_color) expected_due_date_row.add_style('color', expected_due_date_status_color) # Both rows will have the following styles for each_row in [client_deliver_by_row, expected_due_date_row]: each_row.add_style('font-size', '14px') each_row.add_style('font-weight', 'bold') each_row.add_style('text-shadow', '1px 1px #000000') # Set the td's for Client Deliver By row, get the second cell for the padding-left function below date_table.add_cell(data='Client Deliver By:', row=expected_due_date_row) expected_due_date_cell = date_table.add_cell(data=expected_due_date.strftime('%m-%d-%Y %I:%M %p'), row=expected_due_date_row) # Set the td's for Expected Due Date row, get the second cell for the padding-left function below date_table.add_cell(data='Expected Due Date:', row=client_deliver_by_row) client_deliver_by_cell = date_table.add_cell(data=client_deliver_by_date.strftime('%m-%d-%Y %I:%M %p'), row=client_deliver_by_row) # Add left side padding to each of the td's with the dates (looks a little better when rendered) map(lambda x: x.add_style('padding-left', '5px'), [client_deliver_by_cell, expected_due_date_cell]) # Append the date table to the parent table and we're done parent_table.add_cell(data=date_table, row=date_row)
def __init__(self, **kwargs): #self.top = DivWdg() self.kwargs = kwargs self.text_wdg = DivWdg() self.table = Table() self.table.add_row() self.table.add_style("color", "#333") self.td = self.table.add_cell() self.td.add_class("spt_action_button") super(ActionButtonWdgOld, self).__init__() web = WebContainer.get_web() self.browser = web.get_browser()
def add_unassigned_instances(my, widget, shot_inst_names): ''' add the unassigned instances into a SwapDisplayWdg ''' info = [] session = SessionContents.get() if not session: return "" tactic_nodes = session.get_instance_names(is_tactic_node=True) non_tactic_nodes = session.get_node_names(is_tactic_node=False) """ title = HtmlElement.b('Unassigned instances') widget.add(title) # this is just a filler for now, can be any sobjects snapshots = [] for tactic_node in tactic_nodes: if tactic_node not in shot_inst_names: session_version = session.get_version(tactic_node) session_snap = session.get_snapshot(tactic_node) if session_snap: snapshots.append(session_snap) info.append({'session_version': session_version, 'instance':\ tactic_node}) div = DivWdg(id="unassigned_table") SwapDisplayWdg.create_swap_title( title, swap, div) table = TableWdg('sthpw/snapshot', 'session_items') table.set_show_property(False) table.set_aux_data(info) table.set_sobjects(snapshots) div.add(table) widget.add(div) widget.add(HtmlElement.br()) """ # Add other non-tactic nodes swap2 = SwapDisplayWdg.get_triangle_wdg() title2 = HtmlElement.b('Other Nodes') div2 = DivWdg(id="other_node_div") widget.add(swap2) widget.add(title2) SwapDisplayWdg.create_swap_title( title2, swap2, div2) hidden_table = Table(css='table') div2.add(hidden_table) hidden_table.set_max_width() for node in non_tactic_nodes: hidden_table.add_row() hidden_table.add_cell(node) hidden_table.add_blank_cell() widget.add(div2)
def get_display(self): dd_activator = DivWdg() if self.style: dd_activator.add_styles( self.style ) dd_activator.add_style( "width: %spx" % self.width ) dd_activator.add_class("SPT_DTS"); if self.nudge_menu_horiz != 0: dd_activator.set_attr("spt_nudge_menu_horiz", self.nudge_menu_horiz) if self.nudge_menu_vert != 0: dd_activator.set_attr("spt_nudge_menu_vert", self.nudge_menu_vert) # Generate button ... # table = Table() table.add_row() table.add_styles("width: 100%; padding: 0px; margin: 0px;") td = table.add_cell() td.add_looks("menu border curs_default") td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" ) title_div = DivWdg() title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" ) if self.icon_path: img = HtmlElement.img() img.set_attr("src", self.icon_path) img.set_attr("title", self.title) img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;") title_div.add(img) title_div.add_looks("menu") else: title_div.add(self.title) title_div.add_looks("menu fnt_text") td.add( title_div ) td = table.add_cell() # -- Example of setting only some of the borders with dotted style ... # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" ) td.add_looks( "menu_btn_icon border curs_default" ) td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \ "width: 15px; min-width: 15px;" \ "height: 12px; max-height: 12px;" ) arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png") arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" ) td.add( arrow_img ) dd_activator.add(table) dd_activator.add( self.kwargs.get("smart_menu_set") ) dd_activator.add_class("SPT_SMENU_ACTIVATOR") dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu', 'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } ) return dd_activator
def get_sobject_info_wdg(my): div = DivWdg() return div attr_table = Table() div.add(attr_table) attr_table.add_color("color", "color") sobject = my.get_sobject() titles, exprs = my.get_sobject_info() for title, expr in zip(titles, exprs): try: value = Search.eval(expr, sobject) except Exception, e: print "WARNING: ", e.message continue if value == '': value = '<i>none</i>' if len(value) > 100: value = "%s..." % value[:100] attr_table.add_row() th = attr_table.add_header("%s: " % title) th.add_style("text-align: left") td = attr_table.add_cell(value)
def get_display(self): table = Table() self.set_header(table) tasks = get_edel_tasks() for task in tasks: process_cell = table.add_cell(task.get_value('process')) status_cell = table.add_cell(task.get_value('status')) title_order = get_title_order_from_code( task.get_value('search_code')) if (title_order): title_order_cell = table.add_cell( title_order.get_value('name')) else: title_order_cell = table.add_cell() # work_on_task_cell = table.add_cell(WorkElementWdg(search_key='sthpw/task?code=TASK00000009')) # self.apply_styling_to_cells([process_cell, status_cell, title_order_cell, work_on_task_cell]) self.apply_styling_to_cells( [process_cell, status_cell, title_order_cell]) table.add_row() outer_div = DivWdg() outer_div.add(table) return outer_div
def get_display(my): sobject = None code = '' show_checks = False if 'source_code' in my.kwargs.keys(): code = str(my.kwargs.get('source_code')) else: sobject = my.get_current_sobject() code = sobject.get_code() if sobject.get_value('high_security') in [True,'T','t','1']: show_checks = True widget = DivWdg() table = Table() table.add_attr('width', '50px') if show_checks: table.add_style('background-color: #ff0000;') login = Environment.get_login() user_name = login.get_login() table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="Security Checklist" name="Security Checklist" src="/context/icons/32x32/lock_32_01.png">') cell1.add_attr('user', user_name) launch_behavior = my.get_launch_behavior(code,user_name) cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects): """ Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes. If a file is also in the selected_file_sobjects list, check it automatically. :param file_sobjects: List of file sobjects :param selected_file_sobjects: List of file sobjects (that are already selected) :return: Table """ files_checkbox_table = Table() header_row = files_checkbox_table.add_row() header = files_checkbox_table.add_header(data='Files', row=header_row) header.add_style('text-align', 'center') header.add_style('text-decoration', 'underline') for file_sobject in file_sobjects: checkbox = CheckboxWdg(name=file_sobject.get_code()) if file_sobject.get_code() in [selected_file.get_code() for selected_file in selected_file_sobjects]: checkbox.set_checked() checkbox_row = files_checkbox_table.add_row() files_checkbox_table.add_cell(data=checkbox, row=checkbox_row) files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row) return files_checkbox_table
def get_display(self): sobject = self.get_current_sobject() snapshots = [] if isinstance(sobject, Layer): # for layer renders, we try to get all render sobjects renders = Render.get_all_by_sobject(sobject) if renders: snapshots = Snapshot.get_by_sobjects(renders, is_current=True) else: # for object that has direct snapshots like plates snapshot = Snapshot.get_current_by_sobject(sobject) if snapshot: snapshots.append(snapshot) if not snapshots: return "<i>- no files -</i>" div = DivWdg() for snapshot in snapshots: file_types = snapshot.get_all_file_types() table = Table(css='embed') for file_type in file_types: table.add_row() table.add_cell(self.get_open_wdg(snapshot, file_type)) dir = snapshot.get_client_lib_dir(file_type=file_type) table.add_cell("%s: <i>%s</i>" % (file_type, dir)) div.add(table) return div
def get_info_wdg(my, sobject): div = DivWdg() div.add_style("margin: 0px 20px 20px 20px") div.add_style("padding: 20px") div.add_color("background", "background3") div.add_color("color", "color3") div.set_round_corners(5) element_names = my.kwargs.get("element_names") if not element_names: element_names = ["code","name","description",] else: element_names = element_names.split(",") view = "table" from pyasm.widget import WidgetConfigView search_type = sobject.get_search_type() config = WidgetConfigView.get_by_search_type(search_type, view) table = Table() div.add(table) for element_name in element_names: table.add_row() title = Common.get_display_title(element_name) td = table.add_cell("%s: " % title) td.add_style("width: 200px") td.add_style("padding: 5px") element = config.get_display_widget(element_name) element.set_sobject(sobject) element.preprocess() td = table.add_cell(element) td.add_style("padding: 5px") #value = sobject.get_value(element_name, no_exception=True) or "N/A" #table.add_cell(value) div.add("<br/>") from tactic.ui.widget import DiscussionWdg search_key = sobject.get_search_key() notes_wdg = DiscussionWdg(search_key=search_key) notes_wdg.set_sobject(sobject) div.add(notes_wdg) return div
def get_content_wdg(self): div = DivWdg() inner = DivWdg() div.add(inner) # set up the context menus menus_in = { #'DG_HEADER_CTX': [ self.get_smart_header_context_menu_data() ], 'DG_DROW_SMENU_CTX': [self.get_data_row_smart_context_menu_details()] } SmartMenu.attach_smart_context_menu(inner, menus_in, False) if self.sobjects: for i, sobject in enumerate(self.sobjects): if i == 0: self.first = True else: self.first = False inner.add(self.get_item_wdg(sobject)) inner.add("<hr/>") else: table = Table() inner.add(table) self.handle_no_results(table) return div
def get_connect_wdg(my): div = DivWdg() div.set_name("Connection") table = Table() div.add(table) from tactic.ui.panel import EditWdg edit = EditWdg(search_type="sthpw/db_resource", view="edit") table.add_row() table.add_cell(edit) return div
def get_add_chat_wdg(my): div = DivWdg() div.add_border() div.add_style("padding: 20px") div.add_class("spt_add_chat_top") table = Table() table.add_style("width: auto") div.add(table) table.add_row() text = TextInputWdg(title="user", icon="USER_ADD") table.add_cell(text) text.add_class("spt_add_chat_user") add_button = ActionButtonWdg(title="Start Chat") table.add_cell(add_button) add_button.add_behavior({ 'type': 'click_up', 'cbjs_action': ''' var top = bvr.src_el.getParent(".spt_add_chat_top"); var el = top.getElement(".spt_add_chat_user"); var user = el.value; if (!user) { alert("Specify a valid user to chat with"); return; } // new chat var server = TacticServerStub.get(); var category = "chat"; var class_name = 'tactic.ui.app.ChatCmd'; var kwargs = { users: [user] } server.execute_cmd(class_name, kwargs); spt.panel.refresh(bvr.src_el); ''' }) return div
def get_content_wdg(my): my.search_type = my.kwargs.get("search_type") my.collection_key = my.kwargs.get("collection_key") top = DivWdg() top.add_class("spt_collection_top") if not SearchType.column_exists(my.search_type, "_is_collection"): msg_div = DivWdg() top.add(msg_div) msg_div.add("Search Type [%s] does not support collections" % my.search_type) msg_div.add_style("padding: 40px") msg_div.add_style("width: 300px") msg_div.add_style("margin: 100px auto") msg_div.add_border() return top top.add_style("margin: 5px 20px") table = Table() top.add(table) table.add_row() table.add_style("width: 100%") #tr, header = table.add_row_cell() #header.add_style("height: 40px") table.add_row() left = table.add_cell() left.add_style("vertical-align: top") left.add_style("width: 300px") left.add_style("max-width: 300px") left.add_style("height: auto") right = table.add_cell() right.add_style("vertical-align: top") right.add_style("width: auto") right.add_style("height: auto") left.add(my.get_collection_wdg()) right.add(my.get_right_content_wdg()) return top
def get_display(my): dd_activator = DivWdg() if my.style: dd_activator.add_styles( my.style ) dd_activator.add_style( "width: %spx" % my.width ) dd_activator.add_class("SPT_DTS"); if my.nudge_menu_horiz != 0: dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz) if my.nudge_menu_vert != 0: dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert) # Generate button ... # table = Table() table.add_row() table.add_styles("width: 100%; padding: 0px; margin: 0px;") td = table.add_cell() td.add_looks("menu border curs_default") td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" ) title_div = DivWdg() title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" ) if my.icon_path: img = HtmlElement.img() img.set_attr("src", my.icon_path) img.set_attr("title", my.title) img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;") title_div.add(img) title_div.add_looks("menu") else: title_div.add(my.title) title_div.add_looks("menu fnt_text") td.add( title_div ) td = table.add_cell() # -- Example of setting only some of the borders with dotted style ... # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" ) td.add_looks( "menu_btn_icon border curs_default" ) td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \ "width: 15px; min-width: 15px;" \ "height: 12px; max-height: 12px;" ) arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png") arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" ) td.add( arrow_img ) dd_activator.add(table) dd_activator.add( my.kwargs.get("smart_menu_set") ) dd_activator.add_class("SPT_SMENU_ACTIVATOR") dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu', 'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } ) return dd_activator
def get_display(my): sob_sk = '' name = '' height = 20 if 'sk' in my.kwargs.keys(): sob_sk = str(my.kwargs.get('sk')) else: sobject = my.get_current_sobject() sob_sk = sobject.get_search_key() if 'name' in my.kwargs.keys(): name = my.kwargs.get('name') if 'height' in my.kwargs.keys(): height = my.kwargs.get('height') processes = '' if 'processes' in my.kwargs.keys(): processes = my.kwargs.get('processes') widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = None if name == '': cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/_spt_upload.png">') else: cell1 = table.add_cell('<input type="button" value="%s" style="height: %spx"/>' % (name, height)) cell1.add_attr('sk', sob_sk) cell1.add_attr('processes', processes) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_info_wdg(my, sobject): div = DivWdg() div.add_style("margin: 10px 20px 20px 20px") div.add_style("padding: 20px") div.add_color("background", "background", -3) div.add_border() div.add_color("color", "color3") div.set_round_corners(5) div.add_style("height", "100%") div.add_style("position: relative") element_names = my.kwargs.get("element_names") if not element_names: element_names = [ "code", "name", "description", ] else: element_names = element_names.split(",") view = "table" from pyasm.widget import WidgetConfigView search_type = sobject.get_search_type() config = WidgetConfigView.get_by_search_type(search_type, view) table = Table() table.add_style("height", "100%") div.add(table) for element_name in element_names: table.add_row() title = Common.get_display_title(element_name) td = table.add_cell("%s: " % title) td.add_style("width: 200px") td.add_style("padding: 5px") element = config.get_display_widget(element_name) element.set_sobject(sobject) element.preprocess() td = table.add_cell(element) td.add_style("padding: 5px") #value = sobject.get_value(element_name, no_exception=True) or "N/A" #table.add_cell(value) div.add("<br/>") from tactic.ui.widget import DiscussionWdg search_key = sobject.get_search_key() notes_wdg = DiscussionWdg(search_key=search_key) notes_wdg.set_sobject(sobject) div.add(notes_wdg) return div
def get_display(self): sobject = self.get_current_sobject() snapshots = [] if isinstance(sobject, Layer): # for layer renders, we try to get all render sobjects renders = Render.get_all_by_sobject(sobject) if renders: snapshots = Snapshot.get_by_sobjects(renders, is_current=True) else: # for object that has direct snapshots like plates snapshot = Snapshot.get_current_by_sobject(sobject) if snapshot: snapshots.append(snapshot) if not snapshots: return "<i>- no files -</i>" div = DivWdg() for snapshot in snapshots: file_types = snapshot.get_all_file_types() table = Table(css='embed') for file_type in file_types: table.add_row() table.add_cell( self.get_open_wdg(snapshot, file_type) ) dir = snapshot.get_client_lib_dir(file_type=file_type) table.add_cell( "%s: <i>%s</i>" % (file_type, dir) ) div.add(table) return div
def __init__(my, **kwargs): my.table = Table() my.table.add_style("border-collapse: collapse") my.table.add_style("padding: 0px") my.table.set_attr("cellpadding", "0px") my.table.set_attr("cellspacing", "0px") my.is_first_row = True my.hilight = my.table.get_color("background", -40) super(ResizableTableWdg, my).__init__(**kwargs)
def get_display(self): top = self.top top.add_class("spt_share_top") self.set_as_panel(top) top.add_color("background", "background") title = DivWdg() top.add(title) title.add_style("font-size: 18px") title.add_style("font-weight: bold") title.add_style("text-align: center") title.add_style("padding: 10px") #title.add_style("margin: -10px -10px 10px -10px") title.add_gradient("background", "background3", 5, -10) title.add("Share Project") # add the main layout #table = ResizableTableWdg() table = Table() table.add_color("color", "color") top.add(table) table.add_row() left = table.add_cell() left.add_border() left.add_style("vertical-align: top") left.add_style("min-width: 250px") left.add_style("height: 400px") left.add_color("background", "background3") left.add(self.get_share_wdg() ) right = table.add_cell() right.add_border() right.add_style("vertical-align: top") right.add_style("min-width: 400px") right.add_style("width: 100%") right.add_style("height: 400px") right.add_style("padding: 5px") right.add_class("spt_share_content") share_item_wdg = ShareItemWdg() right.add(share_item_wdg) return top
def get_display(my): top = my.top top.add_style("padding: 20px") top.add_color("background", "background") start_date = 'xxx' end_date = 'xxx' days = [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ] start_time = '06:00' end_time = '21:00' table = Table() top.add(table) table.add_row() table.add_header() for day in days: td = table.add_header(day) for hour in xrange(6, 21): tr = table.add_row() td = table.add_cell() td.add("%0.2d:00" % hour) td.add_color("background", "background3") for day in days: td = table.add_cell() day_div = DivWdg() td.add(day_div) day_div.add_style("width: 100px") day_div.add_style("height: 50px") day_div.add_border() day_div = DivWdg() return top
def get_info_wdg(self, sobject): div = DivWdg() div.add_style("margin: 10px 20px 20px 20px") div.add_style("padding: 0px 20px") #div.add_color("background", "background", -3) #div.add_border() #div.add_color("color", "color3") #div.set_round_corners(5) div.add_style("height", "100%") div.add_style("position: relative") element_names = self.element_names config = self.config table = Table() table.add_style("height", "100%") div.add(table) for element_name in element_names: table.add_row() title = Common.get_display_title(element_name) td = table.add_cell("%s: " % title) td.add_style("width: 200px") td.add_style("padding: 5px") element = config.get_display_widget(element_name) if self.first: try: element.handle_layout_behaviors(self.layout_wdg) except Exception as e: print "e :", e pass element.set_sobject(sobject) element.preprocess() td = table.add_cell(element) td.add_style("padding: 5px") #value = sobject.get_value(element_name, no_exception=True) or "N/A" #table.add_cell(value) show_notes = self.kwargs.get("show_notes") if show_notes in [True, 'true']: div.add("<br/>") from tactic.ui.widget import DiscussionWdg search_key = sobject.get_search_key() notes_wdg = DiscussionWdg(search_key=search_key) notes_wdg.set_sobject(sobject) div.add(notes_wdg) return div
def get_display(my): code = '' name = '' if 'code' in my.kwargs.keys(): code = str(my.kwargs.get('code')) if 'name' in my.kwargs.keys(): name = str(my.kwargs.get('name')) else: sobject = my.get_current_sobject() code = sobject.get_code() if 'WORK_ORDER' in code or 'PROJ' in code: name = sobject.get_value('process') elif 'TITLE' in code: name = sobject.get_value('title') if sobject.get_value('episode') not in [None,'']: name = '%s: %s' % (name, sobject.get_value('episode')) elif 'ORDER' in code: name = sobject.get_value('name') if sobject.has_value('lookup_code'): if 'STATUS_LOG' in code: from tactic_client_lib import TacticServerStub my.server = TacticServerStub.get() name = my.server.eval("@GET(sthpw/task['lookup_code','%s'].process)" % sobject.get_value('lookup_code')) if name: name = name[0] else: name = 'Deleted Work Order' else: name = sobject.get_value('process') code = sobject.get_value('lookup_code') widget = DivWdg() table = Table() #table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="Inspect" name="Inspect" src="/context/icons/silk/information.png">') cell1.add_attr('code', code) cell1.add_attr('name',name) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): sobject = my.get_current_sobject() task_table = Table(css="minimal") task_table.add_style("width: 300px") search_key = sobject.get_search_key() tasks = my.tasks_dict.get(search_key) if tasks: for task in tasks: task_table.add_row() process = task.get_value("process") td = task_table.add_cell(HtmlElement.i(process)) task_table.add_data(':') td.add_style("vertical-align: top") td.add_style("text-align: right") td.add_style("width: 75px") td.add_style("padding: 2px") task_table.add_cell( task.get_value("description") ) return task_table
def get_video_measurements_table(self): video_measurements_table = Table() video_measurements_table.add_row() video_measurements_table.add_header('Video Measurements') text_input_name_id_pairs = [ ('Active Video Begins', 'active_video_begins'), ('Active Video Ends', 'active_video_ends'), ('Horizontal Blanking', 'horizontal_blanking'), ('Luminance Peak', 'luminance_peak'), ('Chroma Peak', 'chroma_peak'), ('Head Logo', 'head_logo'), ('Tail Logo', 'tail_logo') ] self.setup_table_rows_with_input_boxes(video_measurements_table, text_input_name_id_pairs) return video_measurements_table
def __init__(self, **kwargs): web = WebContainer.get_web() is_Qt_OSX = web.is_Qt_OSX() self.browser = web.get_browser() #is_Qt_OSX = False if is_Qt_OSX: self.redirect = ActionButtonWdgOld(**kwargs) else: self.redirect = None #self.top = DivWdg() self.kwargs = kwargs self.text_wdg = DivWdg() self.table = Table() self.table.add_row() self.table.add_style("color", "#333") self.td = self.table.add_cell() self.td.add_class("spt_action_button") super(ActionButtonWdg, self).__init__()
def setup_checkboxes_div(header_text, reasons_list): checkbox_table = Table() header_row = checkbox_table.add_row() header = checkbox_table.add_header(data=header_text, row=header_row) header.add_style('text-align', 'center') header.add_style('text-decoration', 'underline') for reason_id, reason_name in reasons_list: checkbox = CheckboxWdg(name=reason_id) checkbox_row = checkbox_table.add_row() checkbox_table.add_cell(data=checkbox, row=checkbox_row) checkbox_table.add_cell(data=reason_name, row=checkbox_row) return checkbox_table
def get_program_format_table(self): program_format_table = Table() program_format_table.add_style('float', 'left') program_format_table.add_row() program_format_table.add_header('Program Format') program_format_table.add_header() text_input_name_id_pairs = [ ('Roll-up (blank)', 'roll_up_blank'), ('Bars/Tone', 'bars_tone'), ('Black/Silence', 'black_silence_1'), ('Slate/Silence', 'slate_silence'), ('Black/Silence', 'black_silence_2'), ('Start of Program', 'start_of_program'), ('End of Program', 'end_of_program') ] self.setup_table_rows_with_input_boxes(program_format_table, text_input_name_id_pairs, timecode=True) return program_format_table
def init(my): my.top = DivWdg() my.content_wdg = DivWdg() is_IE = WebContainer.get_web().is_IE() # get the width and height of the contents (the inner part of the container) ... my.inner_width = my.kwargs.get('inner_width') my.inner_height = my.kwargs.get('inner_height') if my.inner_width: my.inner_width = int(my.inner_width) if is_IE: my.inner_width -= 20 # adjust for rounded corner wrapper else: my.inner_width = 600 if my.inner_height: my.inner_height = int(my.inner_height) if is_IE: my.inner_height -= 20 # adjust for rounded corner wrapper else: my.inner_height = 200 # Now place a ResizeScrollWdg within a RoundedCornerDivWdg ... the ResizeScrollWdg will contain # the actual contents of this container, so that the contents can be scrolled and resized ... # from tactic.ui.container import RoundedCornerDivWdg color = my.top.get_color("background") my.rc_wdg = RoundedCornerDivWdg(hex_color_code=color,corner_size=10) #show_scrollbars = my.kwargs.get("show_resize_scroll") #if show_scrollbars in ['', 'false']: # my.inner_wdg = DivWdg() #else: # from tactic.ui.container import ResizeScrollWdg # my.inner_wdg = ResizeScrollWdg( width=my.inner_width, height=my.inner_height, scroll_bar_size_str='medium', scroll_expansion='inside' ) my.inner_wdg = DivWdg() my.inner_wdg.add_style("width: %s" % my.inner_width) my.inner_wdg.add_style("height: %s" % my.inner_height) my.inner_wdg.add_style("overflow-y: auto") my.inner_wdg.add_style("overflow-x: hidden") my.rc_wdg.add( my.inner_wdg ) my.content_wdg.add(my.rc_wdg) my.table = Table(css="minimal") my.table.add_row() my.content_td = my.table.add_cell() my.content_td.add_class("spt_content") my.content_td.add_style('padding: 2px')
def get_display(my): notification_logins = my.get_logins() table = Table() table.add_color("color", "color") for notification_login in notification_logins: type = notification_login.get_value("type") user = notification_login.get_value("login") table.add_row() table.add_cell(type) table.add_cell(user) return table
def get_content_wdg(my): div = DivWdg() div.add_class("spt_tool_top") table = Table() div.add(table) table.add_row() td = table.add_cell() from table_layout_wdg import FastTableLayoutWdg kwargs = my.kwargs.copy() td.add_style("width: 1%") td.add_style("vertical-align: top") layout_div = DivWdg() layout_div.add_style("min-height: 500px") td.add(layout_div) element_names = my.kwargs.get("element_names") if not element_names: kwargs['element_names'] = [ 'name', 'description', 'detail', 'file_list', 'general_checkin' ] #kwargs['element_names'] = ['preview','name','detail', 'task_summary'] kwargs['show_shelf'] = False kwargs['show_search_limit'] = False layout = FastTableLayoutWdg(**kwargs) layout_div.add(layout) #from tactic.ui.panel import TileLayoutWdg #layout = TileLayoutWdg(**my.kwargs) #layout_div.add(layout) td = table.add_cell() td.add_border(color="#EEE") td.add_style("vertical-align: top") content = DivWdg() td.add(content) content.add_class("spt_tool_content") #content.add_style("margin: -1px") no_content_wdg = DivWdg() content.add(no_content_wdg) no_content_wdg.add("<br/>" * 3) no_content_wdg.add("<i>-- No Content --</i>") #no_content_wdg.add_style("opacity: 0.5") no_content_wdg.add_style("margin: 30px auto") no_content_wdg.add_color("color", "color3") no_content_wdg.add_color("background", "background3") no_content_wdg.add_style("text-align", "center") no_content_wdg.add_style("padding-top: 20px") no_content_wdg.add_style("padding-bottom: 20px") no_content_wdg.add_style("width: 350px") no_content_wdg.add_style("height: 110px") no_content_wdg.add_border() return div
def get_display(my): sobject = my.get_current_sobject() code = sobject.get_code() sk = my.server.build_search_key("twog/movement", code) shipping_class = sobject.get_value("shipping_class") title = sobject.get_value("name") waybill = sobject.get_value("waybill") sending_company_code = sobject.get_value("sending_company_code") receiving_company_code = sobject.get_value("receiving_company_code") shipper_code = sobject.get_value("shipper_code") description = sobject.get_value("description") timestamp = sobject.get_value("timestamp") widget = DivWdg() table = Table() table.add_attr("width", "50px") table.add_row() cell1 = table.add_cell( '<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">' ) launch_behavior = my.get_launch_behavior() cell1.add_attr("sk", sk) cell1.add_attr("shipping_class", shipping_class) cell1.add_attr("to_comp", receiving_company_code) cell1.add_attr("from_comp", sending_company_code) cell1.add_attr("waybill", waybill) cell1.add_attr("title", title) cell1.add_attr("shipper", shipper_code) cell1.add_attr("description", description) cell1.add_attr("timestamp", timestamp) cell1.add_style("cursor: pointer;") cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_display(my): name = '' if 'code' in my.kwargs.keys(): code = my.kwargs.get('code') else: sobject = my.get_current_sobject() code = sobject.get_code() name = sobject.get_value('name') if 'name' in my.kwargs.keys(): name = my.kwargs.get('name') search_on_load = 'false' if 'search_on_load' in my.kwargs.keys(): search_on_load = my.kwargs.get('search_on_load') widget = DivWdg() table = Table() table.add_attr('width', '50px') table.add_row() cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/custom/imdb.png">') cell1.add_attr('code', code) cell1.add_attr('name', name) cell1.add_attr('search_on_load', search_on_load) launch_behavior = my.get_launch_behavior() cell1.add_style('cursor: pointer;') cell1.add_behavior(launch_behavior) widget.add(table) return widget
def get_split_viewer(self): table = Table() table.add_row() td = table.add_cell() inner_wdg = SingleNoteViewerWdg( processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name='left_context_cb', show_context='true', append_context=self.append_context, view=self.view) td.add(inner_wdg) td = table.add_cell() inner_wdg = SingleNoteViewerWdg( processes_names=self.process_names, parent_key=self.kwargs.get('parent_key'), resize='true', checkbox_name='right_context_cb', show_context='true', append_context=self.append_context, view=self.view) td.add(inner_wdg) return table
def get_display(self): sobject = self.get_current_sobject() context = self.kwargs.get('context') if not context: context = "publish" snapshot = Snapshot.get_latest_by_sobject(sobject, context) if not snapshot: return "Nothing checked in" xml = snapshot.get_xml_value("snapshot") print xml.to_string() # this is a comp object ... need to find the shot shot = sobject.get_parent("prod/shot") # now get all of the layers layers = shot.get_all_children("prod/layer") div = DivWdg() table = Table(css='embed') # get the renders for each of the references in the snapshot #ref_nodes = xml.get_nodes("snapshot/file/ref") ref_nodes = xml.get_nodes("snapshot/input_ref") unknown_ref_nodes = xml.get_nodes("snapshot/unknown_ref") if ref_nodes: table.add_row_cell('Ref:') self.draw_node(ref_nodes, table) if unknown_ref_nodes: table.add_row_cell('Unknown Ref:') for node in unknown_ref_nodes: table.add_row() table.add_cell(xml.get_attribute(node, 'path')) div.add(table) return div
def get_display(my): top = my.top top.add_color("background", "background") top.add_color("color", "color") top.add_class("spt_schedule_top") table = Table() #table = ResizableTableWdg() top.add(table) table.add_color("color", "color") table.add_row() left = table.add_cell() user_wdg = my.get_group_wdg() left.add(user_wdg) left.add_style("vertical-align: top") left.add_border() left.add_style("width: 250px") right = table.add_cell() right.add_class("spt_schedule_content") #right.add_border() right.add_style("overflow-x: hidden") right.add(" ") right.add_style("min-width: 500px") right.add_style("width: 100%") right.add_style("height: 500px") div = DivWdg() right.add(div) div.add_style("height: 100px") div.add_style("width: 400px") div.add_color("background", "background3") div.add_color("color", "color3") #div.add_border() div.center() div.add_style("margin-top: 50px") div.add_style("padding-top: 75px") div.add_style("text-align: center") div.add("<b>Select a user on the left</b>") return top
def get_display(self): widget = Widget() project = self.get_current_sobject() table = Table() table.set_class("minimal") for setting in ('dir_naming_cls', 'file_naming_cls', 'code_naming_cls', 'node_naming_cls', 'sobject_mapping_cls'): table.add_row() td = table.add_cell("<i>%s</i>: " % setting) td.add_style("text-align: right") value = project.get_value(setting) table.add_cell(value) widget.add(table) return widget
def get_display(my): div = DivWdg() div.add_class("spt_view_manager_top") my.set_as_panel(div) if not my.search_type or not my.view: return div div.add(my.get_action_wdg()) div.add(HtmlElement.br(2)) tool_bar = my.get_tool_bar() div.add(tool_bar) div.add(HtmlElement.br()) # add the template view containing the possible items to be added # ie: New Folder, New Entry, New Separator menu_div = DivWdg() menu_div.set_id("menu_item_template") menu_div.add_style("display: none") menu_div.add(my.get_section_wdg("_template", editable=False)) div.add(menu_div) table = Table() table.add_row() # add the section td = table.add_cell() project_view = DivWdg() project_view.set_id("menu_item_list") project_view.add(my.get_section_wdg(my.view)) td.add(project_view) td.add_style("vertical-align: top") #td.add_attr("rowspan", "2") tool_bar = my.get_tool_bar() td.add(tool_bar) td.add("<br/>") # add detail information td = table.add_cell(my.get_detail_wdg()) # FIXME: get rid of hard coded classes # set the panel information td.set_id("manage_side_bar_detail") td.add_class("spt_view_manager_detail") td.add_style("display", "table-cell") td.add_attr("spt_class_name", "tactic.ui.panel.ManageSideBarDetailWdg") td.add_attr("spt_search_type", my.search_type) td.add_style("padding: 0 20px 20px 20px") td.add_style("vertical-align: top") div.add(table) return div
def get_display(my): if my.is_refresh: top = Widget() my.add(top) web = WebContainer.get_web() my.checked_processes = web.get_form_values('process_names') left_checked_processes = web.get_form_values('left_process_names') right_checked_processes = web.get_form_values( 'right_process_names') is_split_view = web.get_form_values('split_view') == 'true' else: top = my.get_viewer() my.process_names = [x for x in my.process_names if x] if my.is_refresh: if my.process_names: table = Table() table.add_row() td = table.add_cell() expression = "@SOBJECT(sthpw/note['context','in','%s'])" % '|'.join( my.process_names) table_id = 'main_table_left' left_table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=my.view,\ show_row_select=True, show_insert=False, state={'parent_key': my.parent_key}, inline_search=False, show_refresh=True, expression=expression ) if my.resize: from tactic.ui.container import ResizeScrollWdg inner_wdg = ResizeScrollWdg(width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside') inner_wdg.add(left_table) td.add(inner_wdg) else: td.add(left_table) top.add(table) return top
def get_item_wdg(my, sobject): div = DivWdg() div.add_class("spt_item_top") div.add_style("padding: 10px") SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' ) div.add_class("spt_table_row") div.add_attr("spt_search_key", sobject.get_search_key(use_id=True)) div.add_attr("spt_search_code", sobject.get_code()) name = sobject.get_value("name", no_exception=True) if not name: name = sobject.get_code() div.add_attr("spt_name", name) table = Table() div.add(table) table.set_max_width() tr = table.add_row() width = my.kwargs.get("preview_width") if not width: width = "240px" td = table.add_cell() td.add_style("width: %s" % width); td.add_style("vertical-align: top") """ from tile_layout_wdg import ThumbWdg2 thumb_div = DivWdg() #td.add(thumb_div) thumb_div.add_border() thumb_div.set_box_shadow("0px 0px 5px") thumb_div.add_color("background", "background", -5) thumb_div.add_class("spt_item_content") #thumb_div.add_style("min-height: 120px") thumb = ThumbWdg2() thumb_div.add(thumb) thumb.set_sobject(sobject) """ tile_wdg = my.tile_layout.get_tile_wdg(sobject) td.add(tile_wdg) info_div = my.get_info_wdg(sobject) td = table.add_cell(info_div) td.add_style("vertical-align: top") return div
def get_files_checkbox_for_task(self): files_checkbox_table = Table() header_row = files_checkbox_table.add_row() header = files_checkbox_table.add_header(data='Files', row=header_row) header.add_style('text-align', 'center') header.add_style('text-decoration', 'underline') for file_sobject in self.order_files: checkbox = CheckboxWdg(name=file_sobject.get_code()) if file_sobject.get_code() in [selected_file.get_code() for selected_file in self.selected_files]: checkbox.set_checked() checkbox_row = files_checkbox_table.add_row() files_checkbox_table.add_cell(data=checkbox, row=checkbox_row) files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row) return files_checkbox_table