def __init__(self, xaml_source, literal_string=False): """Initialize WPF window and resources.""" # self.Parent = self wih = Interop.WindowInteropHelper(self) wih.Owner = AdWindows.ComponentManager.ApplicationWindow if not literal_string: if not op.exists(xaml_source): wpf.LoadComponent(self, os.path.join(EXEC_PARAMS.command_path, xaml_source) ) else: wpf.LoadComponent(self, xaml_source) else: wpf.LoadComponent(self, framework.StringReader(xaml_source)) #2c3e50 #noqa self.Resources['pyRevitDarkColor'] = \ Media.Color.FromArgb(0xFF, 0x2c, 0x3e, 0x50) #23303d #noqa self.Resources['pyRevitDarkerDarkColor'] = \ Media.Color.FromArgb(0xFF, 0x23, 0x30, 0x3d) #ffffff #noqa self.Resources['pyRevitButtonColor'] = \ Media.Color.FromArgb(0xFF, 0xff, 0xff, 0xff) #f39c12 #noqa self.Resources['pyRevitAccentColor'] = \ Media.Color.FromArgb(0xFF, 0xf3, 0x9c, 0x12) self.Resources['pyRevitDarkBrush'] = \ Media.SolidColorBrush(self.Resources['pyRevitDarkColor']) self.Resources['pyRevitAccentBrush'] = \ Media.SolidColorBrush(self.Resources['pyRevitAccentColor']) self.Resources['pyRevitDarkerDarkBrush'] = \ Media.SolidColorBrush(self.Resources['pyRevitDarkerDarkColor']) self.Resources['pyRevitButtonForgroundBrush'] = \ Media.SolidColorBrush(self.Resources['pyRevitButtonColor'])
def load_component(xaml_file, comp_type): """Load WPF component from xaml file. Args: xaml_file (str): xaml file path comp_type (System.Windows.Controls): WPF control type Returns: System.Windows.Controls: loaded WPF control """ return wpf.LoadComponent(comp_type, xaml_file)
def __init__(self, context, title='User Input', width=DEFAULT_INPUTWINDOW_WIDTH, height=DEFAULT_INPUTWINDOW_HEIGHT, **kwargs): """Initialize user input window.""" wpf.LoadComponent( self, os.path.join(os.path.dirname(__file__), self.xaml_source)) self.Title = title self.Width = width self.Height = height # WindowStartup Position Window hast Left + Top Property. self.Left = System.Windows.SystemParameters.FullPrimaryScreenWidth / 2 - self.Width / 2 self.Top = 80 self._context = context #private attr. self.response = None #see select button def handle_ESCinput_key(sender, args): """Handle Escape keyboard input""" if args.Key == framework.Windows.Input.Key.Escape: self.Close() sys.exit() #TODO! sysExit. READ self.PreviewKeyDown += handle_ESCinput_key # ESC closes the form # in def setup( **kwargs) self.hide_element(self.clrsearch_b) # func in WPFWindow self.search_tb.Focus() self.checked_only = kwargs.get('checked_only', False) # get() builtin button_name = kwargs.get('button_name', None) if button_name: self.select_b.Content = button_name self.list_lb.SelectionMode = Controls.SelectionMode.Extended self._verify_context() self._list_options() printername = doc.PrintManager.PrinterName #tb_ADDED: Values from Checkbox and Textinput -------------------------- self.dic_dlgval = {} with open(os.path.dirname(__file__) + "\\dlgval.pkl", "a+b") as f: # create and read f.seek(0) try: self.dic = pickle.load(f) except: print "run again" try: self.dic # if dic not exists -> Except clause #print self.dic # testing self.txtbox_paranames.Text = self.dic["paranames"] self.expander.Header += self.dic["paranames"] self.txtbox_printername.Text = printername #self.dic["printername"] self.lb_printfilepath.Content = self.dic["printfilepath"] self.chbox_output.IsChecked = self.dic["output"] self.chbox_pdfexport.IsChecked = self.dic["pdfexport"] except: import traceback errorReport = traceback.format_exc() print(errorReport) #Standard Dialog Values self.txtbox_paranames.Text = "Sheet Number,-,Sheet Name" self.expander.Header += "Sheet Number,_,Sheet Name" self.chbox_output.IsChecked = True
def _make_column_datatemplate(self, package_param_name): dtobj = Windows.DataTemplate() template = self.dt_template.format(param=package_param_name) return wpf.LoadComponent(dtobj, framework.StringReader(template))
def __init__(self, xaml_file_name): wpf.LoadComponent(self, op.join(op.dirname(__file__), xaml_file_name)) self.progress_state = 0 self.output = None self.update_threadid()
def __init__(self, xaml_file_name): wpf.LoadComponent(self, op.join(op.dirname(__file__), xaml_file_name)) self.closed = False self.update_threadid()