def get_save_wdg(my): from tactic.ui.container import DialogWdg dialog = DialogWdg(display=False, width=200, offset={ 'x': 0, 'y': 50 }, show_pointer=False) dialog_id = dialog.get_id() title = 'Save a New View' dialog.add_title(title) div = DivWdg() dialog.add(div) div.add_style("padding: 5 5 5 20") div.add_color("background", "background") my.table_id = my.kwargs.get("table_id") from tactic.ui.panel import ViewPanelSaveWdg save_wdg = ViewPanelSaveWdg(search_type=my.kwargs.get("search_type"), dialog_id=dialog_id, table_id=my.table_id) div.add(save_wdg) return dialog
def get_section_wdg(my, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_class("spt_report_top") section_wdg.add_style("width: 200px") section_wdg.add_style("height: 100px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("0px 0px 10px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") button = IconButtonWdg(title="Options", icon=IconWdg.ARROWHEAD_DARK_DOWN) title_wdg.add(button) button.add_style("float: right") # set up menus menu = my.get_menu() SmartMenu.add_smart_menu_set( button, { 'MENU_ITEM': menu } ) SmartMenu.assign_as_local_activator( button, "MENU_ITEM", True ) section_wdg.add_color("background", "background") #section_wdg.add_gradient("background", "background", 0, -3) section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 5px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 5px") div.add_style("width: 65px") div.add_style("height: 50px") div.add_style("float: left") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_save_wdg(my): from tactic.ui.container import DialogWdg dialog = DialogWdg(display=False, width=200, offset={'x':0,'y':50}, show_pointer=False) dialog_id = dialog.get_id() title = 'Save a New View' dialog.add_title(title) div = DivWdg() dialog.add(div) div.add_style("padding: 5 5 5 20") div.add_color("background", "background") my.table_id = my.kwargs.get("table_id") from tactic.ui.panel import ViewPanelSaveWdg save_wdg = ViewPanelSaveWdg( search_type=my.kwargs.get("search_type"), dialog_id=dialog_id, table_id=my.table_id ) div.add(save_wdg) return dialog
def get_display(my): widget = DivWdg() if my.kwargs.get("is_refresh") == 'true': from tactic.ui.widget import TitleWdg title = TitleWdg(name_of_title='Import CSV',help_alias='importing-csv-data') widget.add(title) widget.add_style('padding: 10px') widget.add_style('font-size: 12px') #widget.add_border() widget.add_color('color','color') widget.add_color('background','background') widget.add_class("spt_import_top") inner = DivWdg() widget.add(inner) inner.add( my.get_first_row_wdg() ) inner.add(ProgressWdg()) if my.is_refresh: return inner else: return widget
def get_arrow_wdg(my): pointer_wdg = DivWdg() pointer_wdg.add_class("spt_popup_pointer") widget.add(pointer_wdg) pointer_wdg.add_style("position: absolute") pointer_wdg.add_style("float: left") pointer_wdg.add_style("background-color", "transparent") #pointer_wdg.add("/\\") arrow = DivWdg() pointer_wdg.add(arrow) arrow.add_style("transform: rotate(-45deg)") arrow.add_style("-webkit-transform: rotate(-45deg)") arrow.add_style("border-style: solid") arrow.add_style("border-width: 1px 1px 0px 0px") arrow.add_style("border-color: #000") arrow.add_style("width: 20px") arrow.add_style("height: 20px") arrow.add_style("margin-top: 0px") arrow.add_color("background-color", "background", -10) pointer_wdg.add_style("left: %s" % (15-offset.get('x'))) pointer_wdg.add_style("top: -10") pointer_wdg.add_style("height: 11") pointer_wdg.add_style("z-index: 10") return pointer_wdg
def get_header_wdg(my): outer = DivWdg() div = DivWdg() outer.add(div) div.add_color("background", "background3") div.add_style("padding: 5px") div.add_border() table = Table() table.add_style("margin-left: auto") table.add_style("margin-right: auto") table.add_color("color", "color") table.add_style("font-size: 1.5em") table.add_style("font-weight: bold") table.add_row() # add the month navigators date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year) month_wdg = DivWdg() month_wdg.add_style("width: 150px") month_wdg.add(date_str) prev_month_wdg = my.get_prev_month_wdg() next_month_wdg = my.get_next_month_wdg() table.add_cell(prev_month_wdg) td = table.add_cell(month_wdg) td.add_style("text-align: center") table.add_cell(next_month_wdg) div.add(table) return outer
def get_tile_wdg(my, sobject): div = DivWdg() div.add_class("spt_tile_top") div.add_class("spt_table_row") top_view = my.kwargs.get("top_view") if top_view: title_wdg = my.get_view_wdg(sobject, top_view) else: title_wdg = my.get_title(sobject) div.add( title_wdg ) div.add_attr("spt_search_key", sobject.get_search_key()) div.add_attr("spt_name", sobject.get_name()) div.add_attr("spt_search_code", sobject.get_code()) SmartMenu.assign_as_local_activator( div, 'DG_DROW_SMENU_CTX' ) div.add_border() div.set_box_shadow() div.add_color("background", "background", -3) div.add_style("margin: 10px") div.add_style("overflow: hidden") div.add_style("float: left") thumb_div = DivWdg() thumb_div.add_class("spt_tile_content") #thumb_div.add_class("spt_tile_detail") div.add(thumb_div) width = 240 height = 160 thumb_div.add_style("width: %s" % width) thumb_div.add_style("height: %s" % height) thumb_div.add_style("overflow: hidden") thumb = ThumbWdg2() thumb.set_sobject(sobject) thumb_div.add(thumb) bottom_view = my.kwargs.get("bottom_view") if bottom_view: div.add( my.get_view_wdg(sobject, bottom_view) ) div.add_attr("ondragenter", "return false") div.add_attr("ondragover", "return false") div.add_attr("ondrop", "spt.thumb.noop(event, this)") return div
def get_display(my): path = my.kwargs.get("path") md5 = my.kwargs.get("md5") snapshot_code = my.kwargs.get("snapshot_code") top = my.top top.add_style("padding: 10px") top.add_color("background", "background", -5) path_div = DivWdg() top.add(path_div) path_div.add("<b>Local Path: %s</b><br/>" % path) path_div.add_style("font-size: 12px") path_div.add_style("margin-bottom: 10px") info_wdg = DivWdg() info_wdg.add_color("background", "background3") top.add(info_wdg) info_wdg.add("md5: %s<br/>" % md5) info_wdg.add("snapshot_code: %s<br/>" % snapshot_code) info_wdg.add_style("padding: 5px") search_key = my.kwargs.get("search_key") sobject = Search.get_by_search_key(search_key) # bit of a hack get the file system paths #spath = Common.get_filesystem_name(path) spath = path.replace(" ", "_") search = Search("sthpw/file") search.add_sobject_filter(sobject) search.add_filter("source_path", spath) search.add_order_by("timestamp desc") files = search.get_sobjects() ''' files_div = DivWdg() files_div.add_style("margin: 5px") files_div.add_style("padding: 5px") files_div.add_border() top.add(files_div) ''' snapshots = [] for file in files: snapshot = file.get_parent() snapshots.append(snapshot) from tactic.ui.panel import StaticTableLayoutWdg table = StaticTableLayoutWdg(search_type="sthpw/snapshot", view="table", show_shelf=False) table.set_sobjects(snapshots) top.add(table) return top
def get_display(my): top = DivWdg() top.add_class("spt_project_top") my.set_as_panel(top) inner = DivWdg() top.add(inner) inner.add_style("padding: 10px") inner.add_color("background", "background") inner.add("In this project, I want to manage: <br/><br/>") categories = ['Project Management', 'Asset Management', 'Budgets and Expenses', 'Ticketing'] category_items = { 'Project Management': [ 'Tasks', 'Work Hours', 'Project Tasks', 'Scheduling', 'Task Pipelines' ], 'Asset Management': [ 'Central Asset Library' ], 'Budgets and Expenses': [ 'Expense List' ], 'Ticketing': [ 'Tickets', 'Sprints', 'Burn Down', ], } categories_div = DivWdg() inner.add(categories_div) for category in categories: category_div = DivWdg() categories_div.add(category_div) category_div.add(category) items = category_items.get(category) for item in items: item_div = DivWdg() category_div.add(item_div) item_div.add(" "*5) checkbox = CheckboxWdg() item_div.add(checkbox) item_div.add(item) category_div.add_style("margin-bottom: 5px") return top
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 get_display(my): top = my.top file_logs = my.kwargs.get("file_logs") print "file_logs: ", file_logs attrs = ['depot', 'action','change','client','desc','digest','fileSize','rev','time','type','user'] # FIXME: depotfile is Perforce specific # handle only one file for now file_log = file_logs[0] file_path = file_log.get("depotFile") # find the number of revisions my.sobjects = [] num_sobjects = len(file_log.get("action")) for i in range(0, num_sobjects): sobject = SearchType.create("sthpw/virtual") my.sobjects.append(sobject) sobject.set_value("depotFile", file_path) sobject.set_value("id", i) # go through each attr for attr in attrs: if attr == 'depot': value = file_path.lstrip("//") parts = value.split("/") value = "//%s" % parts[0] for sobject in my.sobjects: sobject.set_value(attr, value) else: values = file_log.get(attr) for i, value in enumerate(values): my.sobjects[i].set_value(attr, value) title_wdg = DivWdg() top.add(title_wdg) title_wdg.add("File Log for [%s]" % file_path) title_wdg.add_color("color", "color3") title_wdg.add_color("background", "background3") title_wdg.add_style("padding: 10px") title_wdg.add_style("font-size: 14px") title_wdg.add_style("font-weight: bold") from tactic.ui.panel import FastTableLayoutWdg table = FastTableLayoutWdg(search_type="sthpw/virtual", view="table", element_names=attrs, show_shelf=False) table.set_sobjects(my.sobjects) top.add(table) return top
def get_display(my): # set the sobjects to all the widgets then preprocess for widget in my.widgets: widget.set_sobjects(my.sobjects) widget.set_parent_wdg(my) # preprocess the elements widget.preprocess() top = my.top my.set_as_panel(top) inner = DivWdg() top.add(inner) inner.add_color("background", "background") inner.add_color("color", "color") inner.add_class("spt_dashboard_top") title = DivWdg() inner.add(title) title.add(my.get_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) #table = Table() from tactic.ui.container import ResizableTableWdg table = ResizableTableWdg() inner.add(table) table.set_max_width() panels = my.get_panels() for panel in panels: title = panel.get('title') #if title in ['Data', None]: # tr, td = table.add_row_cell() #else: # td = table.add_cell() tr = table.add_row() td = table.add_cell(resize=False) td.add_style("min-height: 100px") td.add_style("vertical-align: top") panel = my.get_panel_wdg(td, panel) td.add(panel) return top
def get_display(self): div = DivWdg() div.add_class("spt_project_template_top") self.set_as_panel(div) div.add_color("background", "background") upload_div = DivWdg() upload_div.add_style("padding: 10px") upload_div.add_style("width: 600px") # add the main layout table = ResizableTableWdg() table.add_color("color", "color") div.add(table) table.add_row() left = table.add_cell() left.add_border() left.add_style("min-width: 250px") left.add_style("height: 400px") left.add(self.get_templates_wdg() ) right = table.add_cell() right.add_border() right.add_style("width: 400px") right.add_style("height: 400px") right.add_style("padding: 5px") right.add_class("spt_project_template_content") template = self.kwargs.get("template") if template: template_dir = Environment.get_template_dir() template_dir = "%s/%s" % (template_dir, template) class_name = 'tactic.ui.app.ProjectTemplateEditWdg'; content_div = ProjectTemplateEditWdg(template_dir=template_dir) else: content_div = DivWdg() content_div.add_style("margin: 40px") content_div.add_style("width: 300px") content_div.add_style("height: 150px") content_div.add_style("opacity: 0.7") content_div.add_border() content_div.add_color("background", "background3") content_div.add("<br/>"*4) content_div.add("No templates selected") content_div.add_style("text-align: center") right.add(content_div) return div
def get_display(my): div = DivWdg() div.add_class("spt_project_template_top") my.set_as_panel(div) div.add_color("background", "background") upload_div = DivWdg() upload_div.add_style("padding: 10px") upload_div.add_style("width: 600px") # add the main layout table = ResizableTableWdg() table.add_color("color", "color") div.add(table) table.add_row() left = table.add_cell() left.add_border() left.add_style("min-width: 250px") left.add_style("height: 400px") left.add(my.get_templates_wdg() ) right = table.add_cell() right.add_border() right.add_style("width: 400px") right.add_style("height: 400px") right.add_style("padding: 5px") right.add_class("spt_project_template_content") template = my.kwargs.get("template") if template: template_dir = Environment.get_template_dir() template_dir = "%s/%s" % (template_dir, template) class_name = 'tactic.ui.app.ProjectTemplateEditWdg'; content_div = ProjectTemplateEditWdg(template_dir=template_dir) else: content_div = DivWdg() content_div.add_style("margin: 40px") content_div.add_style("width: 300px") content_div.add_style("height: 150px") content_div.add_style("opacity: 0.7") content_div.add_border() content_div.add_color("background", "background3") content_div.add("<br/>"*4) content_div.add("No templates selected") content_div.add_style("text-align: center") right.add(content_div) return div
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_section_wdg2(self, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 200px") section_wdg.add_style("height: 175px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("1px 1px 1px 1px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") section_wdg.add_color("background", "background") section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 0px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 3px") div.add_style("margin: 5px") #div.add_style("width: 210px") #div.add_style("height: 170px") div.add_style("width: 105px") div.add_style("height: 85px") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_title_wdg(self, title): #date = "@FORMAT(@STRING($TODAY),'Dec 31, 1999')" #date = Search.eval(date, single=True) title_wdg = DivWdg() title_wdg.add(title) #title_wdg.add(" [%s]" % date) title_wdg.add_style("font-size: 1.33em") title_wdg.add_color("background", "background3") title_wdg.add_color("color", "color3") title_wdg.add_style("padding: 10px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("text-align: center") return title_wdg
def get_display(my): top = my.top my.set_as_panel(top) top.add_class("spt_subscription_top") interval = my.kwargs.get("interval") if not interval: interval = 30 * 1000 else: interval = int(interval) * 1000 inner = DivWdg() top.add(inner) my.set_refresh(inner,interval) inner.add_style("min-width: %spx"%SubscriptionBarWdg.WIDTH) inner.add_style("min-height: 300px") #mode = "all" mode = "new" categories = ['chat','sobject','script','progress'] categories = [None] has_entries = False for category in categories: category_wdg = my.get_category_wdg(category, mode) if category_wdg: inner.add(category_wdg) has_entries = True if not has_entries: no_entries = DivWdg() inner.add(no_entries) no_entries.add_style("padding: 50px") no_entries.add_style("width: %spx"%(SubscriptionBarWdg.WIDTH-50)) no_entries.add_style("height: 100px") no_entries.add_style("margin: 100px auto") no_entries.add_style("text-align: center") no_entries.add_border() no_entries.add_color("background", "background3") no_entries.add("No messages") if my.kwargs.get("is_refresh") == 'true': return inner else: return top
def get_attr_wdg(my): div = DivWdg() div.add_border() # div.add_style("padding: 10px") div.add_color("color", "color") div.add_color("background", "background") div.add_style("height: 100%") div.add_style("min-height: 500px") div.add_style("min-width: 500px") div.add(" ") div.add_class("spt_freeform_attr_top") return div
def get_small_section_wdg(my, title, description, image, behavior): section_wdg = DivWdg() section_wdg.set_round_corners() section_wdg.add_border() section_wdg.add_style("width: 225px") section_wdg.add_style("height: 100px") section_wdg.add_style("overflow: hidden") section_wdg.add_style("margin: 10px") section_wdg.set_box_shadow("0px 0px 5px") title_wdg = DivWdg() section_wdg.add(title_wdg) title_wdg.add(title) title_wdg.add_style("height: 20px") title_wdg.add_style("padding: 3px") title_wdg.add_style("margin-top: 3px") title_wdg.add_style("font-weight: bold") title_wdg.add_gradient("background", "background") section_wdg.add_color("background", "background") #section_wdg.add_gradient("background", "background", 0, -3) section_wdg.add_behavior( { 'type': 'hover', 'add_color_modifier': -5, 'cb_set_prefix': 'spt.mouse.table_layout_hover', } ) desc_div = DivWdg() desc_div.add(description) desc_div.add_style("padding: 5px 10px 10px 5px") div = DivWdg() section_wdg.add(div) div.add_style("padding: 5px") div.add_style("margin: 5px") div.add_style("width: 65px") div.add_style("height: 50px") div.add_style("float: left") div.add_style("text-align: center") div.add(image) section_wdg.add(desc_div) div.add_style("overflow: hidden") section_wdg.add_behavior( behavior ) section_wdg.add_class("hand") return section_wdg
def get_display(self): top = self.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 = self.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_title_wdg(my): if my.parent: code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) search_type_obj = my.parent.get_search_type_obj() else: code = my.sobject.get_value("code", no_exception=True) name = my.sobject.get_value("name", no_exception=True) search_type_obj = my.sobject.get_search_type_obj() title = DivWdg() search = Search("sthpw/snapshot") search.add_filter("search_type", "sthpw/search_type") search.add_filter("search_code", search_type_obj.get_value("code")) if search.get_sobject(): thumb = ThumbWdg() title.add(thumb) thumb.set_icon_size(30) thumb.set_sobject(search_type_obj) thumb.add_style("float: left") title.add_color("background", "background3") title.add_style("height: 20px") title.add_style("padding: 6px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() stype_title = search_type_obj.get_value("title") if stype_title: title.add("%s: " % stype_title) if name: title.add("%s" % name) if code: title.add(" <i style='font-size: 0.8; opacity: 0.7'>(%s)</i>" % code) elif code: title.add("%s" % code) else: title.add("(No name)") return title
def get_display(my): paths = my.get_files() top = my.top top.add_style("padding: 10px") top.add_color("background", "background") top.add_style("min-width: 500px") top.add_style("font-size: 12px") top.add_class("spt_sobject_dir_list_top") my.set_as_panel(top) inner = DivWdg() top.add(inner) show_title = my.kwargs.get("show_title") if show_title not in [False, 'false']: title_wdg = DivWdg() inner.add(title_wdg) title_wdg.add("File Browser [%s]" % my.sobject.get_code()) title_wdg.add_color("background", "background3") title_wdg.add_style("padding: 16px 10px") title_wdg.add_style("margin: -10px -10px 10px -10px") title_wdg.add_style("font-weight: bold") show_shelf = my.kwargs.get("show_shelf") if show_shelf not in [False, 'false']: shelf_wdg = DivWdg() inner.add(shelf_wdg) shelf_wdg.add(my.get_shelf_wdg()) shelf_wdg.add_style("padding: 5px") shelf_wdg.add_style("margin: -5px -5px 15px -5px") shelf_wdg.add_style("font-weight: bold") base_dir = Environment.get_asset_dir() dir_list = SnapshotDirListWdg(base_dir=base_dir, location="server", show_base_dir=True,paths=paths, all_open=True, files=my.files, snapshots=my.snapshots) inner.add(dir_list) if my.kwargs.get("is_refresh"): return inner else: return top
def get_panel_wdg(my, td, panel): title = panel.get("title") widget = panel.get("widget") width = panel.get("width") #height = panel.get("height") #if not height: # height = "250px" #td.add_style("height: %s" % height) if width: td.add_style("width: %s" % width) td.add_border() div = DivWdg() div.add_style("padding: 5px") #div.add_style("padding: 10px") title_wdg = DivWdg() div.add(title_wdg) title_wdg.add_style("padding: 5px") #title_wdg.add_style("margin: -12px -12px 10px -12px") title_wdg.add_style("margin: -6px -7px 5px -7px") title_wdg.add_style("font-weight: bold") title_wdg.add_style("font-size: 14px") if title: title_wdg.add_color("background", "background", -5) title_wdg.add_color("color", "color", -10) title_wdg.add_border() title_wdg.add(title) from tactic.ui.app import HelpButtonWdg help_wdg = HelpButtonWdg(alias=my.get_help_alias()) help_wdg.add_style("float: right") help_wdg.add_style("margin-top: -5px") title_wdg.add(help_wdg) else: title_wdg.add_style("height: 10px") if widget: div.add(widget) return div
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) info_div = my.get_info_wdg(sobject) td = table.add_cell(info_div) td.add_style("vertical-align: top") return div
def get_display(my): alias = my.kwargs.get("alias") div = DivWdg() div.add_style("padding: 15px") div.add_style("margin: 10px") div.add_border() div.add_color("background", "background", -5) div.add_style("text-align: center") div.add_style("font-weight: bold") icon = IconWdg("WARNING", IconWdg.HELP_MISSING) div.add(icon) div.add("Add custom documentation page by clicking the Create button") from tactic.ui.widget import ActionButtonWdg button = ActionButtonWdg(title="Create", tip="Create docs for this view") div.add(button) button.add_style("margin-right: auto") button.add_style("margin-left: auto") button.add_style("margin-top: 15px") button.add_style("margin-bottom: 15px") # FIXME: copied code from above button.add_behavior( { "type": "click_up", "cbjs_action": """ spt.tab.set_main_body_tab(); var class_name = 'tactic.ui.app.HelpEditWdg'; var element_name = spt.help.get_view(); if (!element_name) { element_name = "default"; } var kwargs = { view: element_name } spt.tab.add_new("help_edit", "Help Edit", class_name, kwargs); """, } ) return div
def get_display(my): top = DivWdg() top.add_color("color", "color") #top.add_color("background", "background") top.add_class("spt_simple_upload_top") top.add(my.browse) hidden = HiddenWdg( "%s|path" % my.get_input_name() ) hidden.add_class("spt_upload_hidden") top.add(hidden) # this can be used for some other transaction that picks up this file to checkin hidden = HiddenWdg( "%s|ticket" % my.get_input_name() ) hidden.add_class("spt_upload_ticket") top.add(hidden) # if not specified, get the sobject's icon context my.context = my.kwargs.get("context") if not my.context: current = my.get_current_sobject() if current: my.context = current.get_icon_context() else: from pyasm.biz import Snapshot my.context = Snapshot.get_default_context() top.add_attr("spt_context", my.context) top.add( my.get_info_wdg() ) files_div = DivWdg() top.add(files_div) files_div.add_class("spt_upload_files") files_div.add_style("font-size: 11px") files_div.add_style("margin-top: 10px") my.add_action() return top
def get_title_wdg(my): title = DivWdg() title.add_color("background", "background3") title.add_style("height: 20px") title.add_style("padding: 6px") title.add_style("font-weight: bold") title.add_style("font-size: 1.4em") title.add_border() code = my.parent.get_value("code", no_exception=True) name = my.parent.get_value("name", no_exception=True) process = my.sobject.get("process") task_code = my.sobject.get("code") bgcolor = title.get_color("background") title.add("<span style='font-size: 1.2em; padding: 4px; margin: 0px 20px 0px 0px; background-color: %s'>%s</span> Task <i style='font-size: 0.8em'>(%s)</i> for %s <i style='font-size: 0.8em'>(%s)</i>" % (bgcolor, process, task_code, name, code)) return title
def get_display(my): title = DivWdg() title.add(my.name_of_title) title.add_style("padding: 5px") title.add_style("margin: -10px -10px 10px -10px") title.add_style("font-weight: bold") title.add_style("font-size: 14px") title.add_gradient("background", "background", -10) title.add_color("color", "color", -10) title.add_border() from tactic.ui.app import HelpButtonWdg help_wdg = HelpButtonWdg(alias=my.help_alias) help_wdg.add_style("float: right") help_wdg.add_style("margin-top: -5px") title.add(help_wdg) return title
def get_middle_wdg(self): div = DivWdg() #button = ActionButtonWdg(title="<<<") #div.add(button) div.add("<br/>") div.add("<br/>") div.add("<br/>") div.add("<br/>") div.add_color("background", "background") div.add_style("width: 35px") div.add_style("height: 100%") div.add_style("padding: 15px") button = SingleButtonWdg(icon=IconWdg.ARROW_RIGHT) div.add(button) return div
def get_display(my): top = my.top my.set_as_panel(top) top.add_class("spt_share_item") my.server_code = my.kwargs.get("server_code") if not my.server_code: top.add("No server selected") return top my.server = Search.get_by_code("sthpw/sync_server", my.server_code) my.base_dir = my.server.get_value("base_dir") title_wdg = DivWdg() top.add( title_wdg ) title_wdg.add( my.server_code ) title_wdg.add_style("padding: 10px") title_wdg.add_color("background", "background", -10) title_wdg.add_border() title_wdg.add_style("margin: -6px -6px 10px -6px") title_wdg.add_style("font-weight: bold") description = my.server.get_value("description") title_wdg.add(" <i style='font-size: 9px; opacity: 0.5'>( %s )</i>" % description ) from tactic.ui.container import TabWdg tab = TabWdg(selected="Info", show_add=False) top.add(tab) tab.add(my.get_info_wdg()) tab.add(my.get_files_wdg()) tab.add( my.get_tools_wdg() ) return top
def get_display(my): msg = my.kwargs.get("message") arrow_div = DivWdg() icon = IconWdg(msg, IconWdg.ARROW_UP_LEFT_32) icon.add_style("margin-top: -20") icon.add_style("margin-left: -15") icon.add_style("position: absolute") arrow_div.add(icon) arrow_div.add(" "*5) arrow_div.add("<b>%s</b>" % msg) arrow_div.add_style("position: relative") arrow_div.add_style("margin-top: 5px") arrow_div.add_style("margin-left: 20px") arrow_div.add_style("float: left") arrow_div.add_style("padding: 25px") arrow_div.set_box_shadow("1px 1px 2px 2px") arrow_div.set_round_corners(30) arrow_div.add_color("background", "background") return arrow_div