def __init__(self, xaml_file): self.Parent = self if not op.exists(xaml_file): # noinspection PyUnresolvedReferences wpf.LoadComponent(self, os.path.join(__commandpath__, xaml_file)) else: wpf.LoadComponent(self, xaml_file)
def __init__(self, xaml_file, literal_string=False): self.Parent = self if not literal_string: if not op.exists(xaml_file): # noinspection PyUnresolvedReferences wpf.LoadComponent(self, os.path.join(__commandpath__, xaml_file)) else: wpf.LoadComponent(self, xaml_file) else: wpf.LoadComponent(self, StringReader(xaml_file))
def __init__(self, ss): wpf.LoadComponent(self, 'CameraDisplay.xaml') DLLDir = r"./Cameracapture_dll.dll" try: self.Cameracapturedll = CDLL(DLLDir) except: DLLDir = r"..\..\CameracaptureDLL\Debug\CameraCapture.dll" self.Cameracapturedll = CDLL(DLLDir) #DLLDir = r"C:\Users\Administrator\Desktop\xy2017\Day8\client-WPF\Cameracapture_dll.dll" ##DLLDir = cdll.LoadLibrary('Cameracapture_dll.dll') ##self.Addr=Addr self.ss = ss #try : # self.Cameracapturedll = CDLL(DLLDir) #except : # DLLDir =os.getcwd() + r"C:\Users\Administrator\Desktop\xy2017\Day8\client-WPF\Cameracapture_dll.dll"#os.getcwd() + r"\Debug\Cameracapture_dll.dll" # self.Cameracapturedll = CDLL(DLLDir) self.Cameracapturedll.CreateNewCamera() self.width = self.Cameracapturedll.CameraWidth() self.height = self.Cameracapturedll.CameraHeight() self.total_bytes = (self.width * 4) * (self.height) self.CameraDisplay.BeginInit() self.wbbmp = WriteableBitmap(self.width, self.height, 96, 96, PixelFormats.Bgr32, None) self.CameraDisplay.Source = self.wbbmp self.CameraDisplay.EndInit() self.Show() self._worker = BackgroundWorker() self._worker.DoWork += self.WorkLoop self._worker.RunWorkerCompleted += self.CleanUp self._worker.WorkerSupportsCancellation = True self._worker.RunWorkerAsync()
def __init__(self): wpf.LoadComponent(self, 'CelsiusConverter.xaml') model = Model() viewModel = ViewModel(model) self.DataContext = viewModel self._CelsiusBox.GotKeyboardFocus += viewModel.swap_focus self._FahrenheitBox.GotKeyboardFocus += viewModel.swap_focus
def __init__(self): wpf.LoadComponent(self, 'Content/Console.xaml') self.__oldstdout = sys.stdout self.__olderrout = sys.stderr sys.stdout = self sys.stderr = self self.threadid = thread.get_ident()
def __init__(self, host=None, port=None, testFile=None): self.ui = wpf.LoadComponent(self, 'WindowMain.xaml') self.sidebar = self.ui.sidebar self.model = AppVM( ) #object to which UI thread and socket thread will communicate self.client = Client() #setup ui threadupdate self.updater = DispatcherTimer() self.updater.Tick += self.update_UI self.updater.Interval = TimeSpan(0, 0, 0, 0, 33) self.updater.Start() if host != None and port != None: p = int(port) h = str(host) self.submit_message("/connect {0} {1}".format(h, p)) #run test script if testFile != None: try: file = open(testFile) text = file.read() lines = text.split("\n") for line in lines: self.submit_message(line) MessageBox.Show("Test file has been run.") except: MessageBox.Show("Failed to open " + testFile)
def __init__(self, manager): self.ready = False self.manager = manager self.modelview = manager.modelview self.closing = False self.debug = self.modelview.debug try: for key, val in img_tree.items(): self.Resources.Add(key, val) self.Resources.Add('mode_dbg', manager.mode_dbg) # load xaml and bind context to modelview wpf.LoadComponent(self, os.path.join(DIR_PATH, 'core', 'ui.xaml')) self.DataContext = self.modelview self.ui_tabs_control.SelectedIndex = 0 param = self.manager.settings['window'] self.Left = param['Left'] self.Top = param['Top'] self.Width = param['Width'] self.Height = param['Height'] self.ready = True except Exception as error: ok_error('Sorry, cannot load the xaml :' + str(error))
def __init__(self): wpf.LoadComponent(self, '3DSVideoConverter.xaml') self.InputFile.Drop += self.dropHandler self.ConvertBtn.Click += self.convertHandler self.AboutBtn.Click += self.aboutHandler self.info = {} self.initPipeVars()
def __init__(self, parent, msg): wpf.LoadComponent(self, 'WizardDialog.xaml') self.Title = "Error" self.SizeToContent = SizeToContent.WidthAndHeight #self.WindowStartupLocation = WindowStartupLocation.Manual self.Left = parent.Left + parent.ActualWidth / 4 self.Top = parent.Top + parent.ActualHeight / 4 stack = Controls.StackPanel() stack.Orientation = Controls.Orientation.Horizontal stack.HorizontalAlignment = HorizontalAlignment.Center stack.Margin = Thickness(10.0, 6.0, 10.0, 6.0) errorImage = Controls.Image() errorImage.Margin = Thickness(6.0, 6.0, 0.0, 10.0) errorImage.Source = ImageAwesome.CreateImageSource( FontAwesomeIcon.ExclamationCircle, Media.Brushes.Red) errorImage.Width = 14 errorImage.Height = 18 stack.Children.Add(errorImage) label = Controls.Label() #label.Style = self.FindResource("ctrl") #label.FontSize = 16 label.Content = msg label.Margin = Thickness(0.0, 6.0, 0.0, 10.0) stack.Children.Add(label) self.Base.Children.Add(stack) self.button = Controls.Button() #self.button.Style = self.FindResource("wzdbtn") self.button.Click += self.buttonClick self.button.Content = "OK" self.button.Width = 70 self.button.Height = 30 self.button.Margin = Thickness(0.0, 6.0, 0.0, 12.0) self.Base.Children.Add(self.button) self.ShowDialog()
def __init__(self, xaml): self._xaml = xaml xr = XmlReader.Create(StringReader(self._xaml)) self.winLoad = wpf.LoadComponent(self, xr) #self._comboBox = self.winLoad.FindName('_comboBox') # not necessary with wpf IronPython Module Wpf for x in range(1, 10): self._comboBox.Items.Add("Item " + str(x))
def __init__(self): wpf.LoadComponent(self, xamlfile) self.Icon = Media.Imaging.BitmapImage(Uri(dir_name + "\portcoast.ico", UriKind.Relative)) self.lbCategories.ItemsSource = cbs
def __init__(self): wpf.LoadComponent(self, 'Calc.xaml') controls = [ n for n in Walk(self) if isinstance(n, Button) or isinstance(n, TextBox) ] for c in controls: c.FontSize *=2 calculator.enliven(self)
def __init__(self, xaml_file_name, title, labelname): wpf.LoadComponent(self, xaml_file_name) self.title = title self.labelname = labelname self.Title = self.title self.label.Content = labelname global TextReturn self.TextReturn = "Cancel"
def __init__(self): wpf.LoadComponent(self, xamlfile) logo = Image() bi = BitmapImage() bi.BeginInit() bi.UriSource = Uri("/logo-portcoast.png", UriKind.Relative) bi.EndInit() logo.Source = bi
def __init__(self, parent): wpf.LoadComponent(self, 'Progress3D.xaml') self.SizeToContent = SizeToContent.WidthAndHeight #self.WindowStartupLocation = WindowStartupLocation.Manual self.Left = parent.Left + parent.ActualWidth / 4 self.Top = parent.Top + parent.ActualHeight / 4 self.CancelBtn.Click += self.cancel self.Closed += self.closeHandle self.parent = parent
def __init__(self): wpf.LoadComponent(self, 'winMain.xaml') self.WindowStartupLocation = WindowStartupLocation.CenterScreen self.Loaded += self.OnLoaded self.OnLoadContent = self.LoadContent #user data self.configloader = globalspace.loader self.InitMenu() pass
def __init__(self, xaml_file_name, title, labelname): self.Icon = System.Windows.Media.Imaging.BitmapImage(System.Uri(r"{}\Image\{}".format(FilePath, "Makememad.PNG"), System.UriKind.Relative)) wpf.LoadComponent(self, xaml_file_name) self.title = title self.labelname = labelname self.Title = self.title self.label.Content = labelname global TextReturn self.TextReturn = "Cancel"
def __init__(self, selectedElements): wpf.LoadComponent(self, xamlfile) self.selectedElements = selectedElements self.revit_operator = RevitOperator() text = "" for elem in self.selectedElements: text += elem.Id.ToString() text += " / " self.selected_model_group.Text = text
def __init__(self, buildgroup, configitem, buildloader): wpf.LoadComponent(self, 'Content/BuilderContent.xaml') self.loader = buildloader self.configitem = configitem self.buildgroup = buildgroup #parare data_show self.buildprojects = ObservableCollection[object]() self.buildoption = buildoptions() self.InitData()
def __init__(self): self.ui = wpf.LoadComponent(self, StringReader(MyForm.LAYOUT)) collElems = FilteredElementCollector( doc, doc.ActiveView.Id).OfClass(FamilyInstance).ToElements() collElems = sorted(collElems, key=lambda x: x.Name) for e in collElems: item = System.Windows.Controls.ListBoxItem() item.Content = e.Name item.Tag = e.Id self.ui.listBox1.Items.Add(item)
def __init__(self): wpf.LoadComponent(self, 'Wpf6Complex.xaml') europe = ["France", "Germany", "UK"] # a list of strings area = ["Mainland", "Guernsey", "Jersey"] self.label.Content = "Enter total before Tax" self.label1.Content = "Select destination country " self.textBox.Text = "0" # anything other than a number will crash the program self.listBox.ItemsSource = europe # listBox item source populated with a list self.label2.Content = "Total cost including Tax = " self.listBox1.ItemsSource = area
def __init__(self, configitem, buildloader): wpf.LoadComponent(self, 'Pages/Builder.xaml') self.configitem = configitem self.loader = buildloader self.InitTabs() CTUtils.SetUserControlItems_LoadContent(self, self.LoadContent) self.NavigatedFrom += self.OnNavigatedFrom self.NavigatedTo += self.OnNavigatedTo self.FragmentNavigation += self.OnFragmentNavigation self.NavigatingFrom += self.OnNavigatingFrom
def __init__(self): ## LoadComponent reads xaml to fill in Window contents, creates ## NewGameDialog members for named elements in the xaml, and hooks up ## event handling methods. wpf.LoadComponent(self, "NewGameDialog.xaml") self.sizeText.Text = "19" ## For now we only handle 19x19 games self.sizeText.IsReadOnly = True self.handicapText.Text = "0" self.komiText.Text = "0.5"
def __init__(self, prompt=DEFAULT_PROMPT, title=DEFAULT_TITLE): """ Warning to check ROIs selected for export Ok and cancel buttons """ wpf.LoadComponent(self, GUI_XAML_FILE) self.Title = title self.lblPrompt.Content = prompt
def __init__(self): line = "" count = 0 first = True data = " " wpf.LoadComponent(self, 'xlassix.xaml') self.rich = self.FindName('box') self.user = self.FindName('username') self.year = self.FindName('year') self.warning = self.FindName("inyear") self.rich.Text = 'fill in the forms' + '\n'
def __init__(self, title, imagesets, plans, beamsets, modes): wpf.LoadComponent(self, 'CopyBeamset.xaml') self.Title = title self.cbPlans.ItemsSource = plans self.cbBeamsets.ItemsSource = beamsets self.cbFromCT.ItemsSource = imagesets self.cbToCT.ItemsSource = imagesets self.cbMode.ItemsSource = modes
def __init__(self, title, label = "Find and Replace", button_name = "Rename"): self.add_wpf_resource() path_xaml_file = os.path.join(PATH_SCRIPT, 'FindReplace.xaml') wpf.LoadComponent(self, path_xaml_file) # self.form = forms.WPFWindow.__init__(self, path_xaml_file) self.UI_label.Content = label self.UI_main_button.Content = button_name self.main_title.Text = title self.ShowDialog()
def __init__(self): wpf.LoadComponent(self, 'Pages/Logs.xaml') CTUtils.SetUserControlItems_LoadContent(self, self.LoadContent) #containers = CTUtils.GetControlChildObjects_byTypeName(self.content, "FirstFloor.ModernUI.Windows.Controls.ModernTab") #for obj in containers: # obj.ContentLoader.OnLoadContent = self.LoadContent #self.OnLoadContent = self.LoadContent self.NavigatedFrom += self.OnNavigatedFrom self.NavigatedTo += self.OnNavigatedTo self.FragmentNavigation += self.OnFragmentNavigation self.NavigatingFrom += self.OnNavigatingFrom
def __init__(self, title, imagesets, roigeometries): wpf.LoadComponent(self, "D:\\hill103\\Script\\XAML for Reference\\roi_comparison.xaml") self.Title = title self.cbImageSets.ItemsSource = imagesets self.cbRoiA.ItemsSource = roigeometries self.cbRoiB.ItemsSource = roigeometries self.selected_image_set = 0 self.bCompute.Click += self.compute_clicked
def __init__(self, title, default=None, description=None): self.selected = None self.ui = wpf.LoadComponent(self, StringReader(TextInput.LAYOUT)) # self.ui = wpf.LoadComponent(self, os.path.join(cwd, 'form_text_input.xaml')) self.ui.Title = title if default is not None: self.ui.text_box.Text = default if description is not None: self.ui.selection_label.Content = description self.ui.button_select.Click += self.select_click