def get_date_calendar_wdg(): date_calendar_wdg = CalendarInputWdg("due_date") date_calendar_wdg.set_option('show_activator', 'true') date_calendar_wdg.set_option('show_time', 'false') date_calendar_wdg.set_option('width', '300px') date_calendar_wdg.set_option('id', 'due_date') date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY') return date_calendar_wdg
def get_date_calendar_wdg(self): date_calendar_wdg = CalendarInputWdg("date") date_calendar_wdg.set_option('show_activator', 'true') date_calendar_wdg.set_option('show_time', 'false') date_calendar_wdg.set_option('width', '300px') date_calendar_wdg.set_option('id', 'date') date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY') if self.prequal_eval_sobject: date_calendar_wdg.set_value(self.prequal_eval_sobject.get_value('date')) return date_calendar_wdg
def get_record_date_calendar_wdg(self): record_date_calendar_wdg = CalendarInputWdg("record_date") record_date_calendar_wdg.set_option('show_activator', 'true') record_date_calendar_wdg.set_option('show_time', 'false') record_date_calendar_wdg.set_option('width', '300px') record_date_calendar_wdg.set_option('id', 'record_date') record_date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY') if hasattr(self, 'record_date'): record_date_calendar_wdg.set_value(self.record_date) return record_date_calendar_wdg
def get_datetime_calendar_wdg(): """ Get a CalendarInputWdg that displays the time. :return: CalendarInputWdg """ date_calendar_wdg = CalendarInputWdg("datetime_calendar") date_calendar_wdg.set_option('show_activator', 'true') date_calendar_wdg.set_option('show_time', 'true') date_calendar_wdg.set_option('width', '300px') date_calendar_wdg.set_option('id', 'datetime_calendar') return date_calendar_wdg
def get_date_calendar_wdg(self): date_calendar_wdg = CalendarInputWdg("date") date_calendar_wdg.set_option('show_activator', 'true') date_calendar_wdg.set_option('show_time', 'false') date_calendar_wdg.set_option('width', '300px') date_calendar_wdg.set_option('id', 'date') date_calendar_wdg.set_option('display_format', 'MM/DD/YYYY') try: date_calendar_wdg.set_value(self.current_date) except AttributeError: pass return date_calendar_wdg
def get_display(self): div_wdg = DivWdg() div_wdg.set_id('change-order-expected-completion-date') calendar_wdg = CalendarInputWdg( name='change-expected-completion-date-calendar', width='120px') time_wdg = TimeInputWdg(name='change-expected-completion-date-time') div_wdg.add(get_label_widget('Date')) div_wdg.add(calendar_wdg) div_wdg.add(get_label_widget('Time')) div_wdg.add(time_wdg) submit_button = SubmitWdg('Submit') submit_button.add_behavior(self.submit_button_behavior()) div_wdg.add(submit_button) return div_wdg
def get_default_display_wdg(cls, element_name, display_options, element_type, kbd_handler=False): from pyasm.widget import TextAreaWdg, CheckboxWdg, SelectWdg, TextWdg if element_type in ["integer", "smallint", "bigint", "int"]: behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableIntegerTextEdit' } input = TextWdg("main") input.set_options(display_options) if kbd_handler: input.add_behavior(behavior) elif element_type in ["float"]: behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableFloatTextEdit' } input = TextAreaWdg("main") input.set_options(display_options) if kbd_handler: input.add_behavior(behavior) elif element_type in ["string", "link", "varchar", "character", "timecode"]: behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableMultiLineTextEdit' } input = TextWdg('main') input.set_options(display_options) if kbd_handler: input.add_behavior(behavior) elif element_type in ["text"]: behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableMultiLineTextEdit' } input = TextAreaWdg('main') input.set_options(display_options) if kbd_handler: input.add_behavior(behavior) elif element_type == "boolean": input = CheckboxWdg('main') input.set_options(display_options) input.add_behavior( {"type" : "click_up", 'propagate_evt': True}) elif element_type in ["timestamp", "date", "time", "datetime2"]: from tactic.ui.widget import CalendarInputWdg, CalendarWdg, TimeInputWdg # FIXME: take wild guess for the time if element_name.endswith("_time"): #input = TimeInputWdg() behavior = { 'type': 'keyboard', 'kbd_handler_name': 'DgTableMultiLineTextEdit' } input = TextWdg('main') input.set_options(display_options) if kbd_handler: input.add_behavior(behavior) else: #input = CalendarWdg() input = CalendarInputWdg() input.set_option('show_activator', False) #input.set_options(display_options) elif element_type == 'datetime': from tactic.ui.widget import CalendarInputWdg input = CalendarInputWdg() input.set_option('show_time', 'true') elif element_type == "color": from tactic.ui.widget import ColorInputWdg input = ColorInputWdg() input.set_options(display_options) elif element_type =="sqlserver_timestamp": # NoneType Exception is prevented in WidgetConfig already input = None else: # else try to instantiate it as a class print "WARNING: EditWdg handles type [%s] as default TextWdg" %element_type input = TextWdg() input.add("No input defined") return input
def get_display(self): from tactic.ui.report import MMSUtility import datetime date = datetime.datetime.now() start_wday, end_wday = MMSUtility.get_week_range(date) self.prefix = 'week' top = DivWdg() top.add_class("spt_table_search") self.set_as_panel(top) from tactic.ui.container import RoundedCornerDivWdg inner = RoundedCornerDivWdg(corner_size=10, hex_color_code='949494') inner.set_dimensions(width_str="95%", content_height_str='95%', height_str="100%") inner.add_style("margin: 20px") top.add(inner) hidden = HiddenWdg("prefix", self.prefix) top.add(hidden) filter_data = FilterData.get() values = filter_data.get_values_by_index("week", 0) date_string = values.get("calendar") if not date_string: date_string = WebContainer.get_web().get_form_value("calendar") if date_string: date = parser.parse(date_string) else: date = datetime.datetime.now() week = 1 table = Table() table.add_style("color: black") table.add_style("width: 600px") table.add_row() inner.add(table) #inner.add("Range: %s - %s<br/><br/>" % (start_wday, end_wday)) table.add_cell("Week Of Date: <br/>") calendar = CalendarInputWdg('calendar') day_cbk = ''' var top = spt.get_parent(bvr.src_el, '.spt_table_search'); var week_el = top.getElement('.spt_calendar_week'); var input_el = top.getElement('.spt_calendar_input'); var value = input_el.value; var week = spt.date_util.ymd.get_week( value ) week_el.innerHTML = week + ''; ''' calendar.add_day_cbk(day_cbk) #calendar.set_option("first_day_of_week", 4) calendar.set_value(date.strftime("%Y-%m-%d")) # TODO: set default table.add_cell(calendar) week = int(date.strftime("%W")) + 1 table.add_cell("Week: ") #select = SelectWdg("week") #select.add_class("action inputfield") #select.set_option("values", range(1,53) ) #select.set_value(week) #select.set_option( "size", "2" ) text = DivWdg() text.add_class("spt_calendar_week") text.add_style("width", "25px") text.add(week) table.add_cell(text) table.add_cell(self.get_search_wdg()) return top