def button1_Click_1(self, sender, e): dialog = SaveFileDialog() dialog.Filter = "aedt files (*.aedt)|*.aedt" if dialog.ShowDialog() == DialogResult.OK: for i in self.Controls: i.Enabled = False model = generateSourceSinkModel(padInfo) ExportQ3D(dialog.FileName) source_sink_faces = getSourceSinkFaces(model) isSourceMerge = self.checkBox1.Checked isSinkMerge = self.checkBox2.Checked try: global rule rule = self.toolStripComboBox1.Text setSourceSink(source_sink_faces, isSourceMerge, isSinkMerge) removeSheet() except: logging.exception(source_sink_faces) MessageBox.Show("Failed!", 'Error') raise MessageBox.Show("Completed!", 'Information') self.Close() else: pass
def onSave(self, _, __): selectedTab = self.tabControl.SelectedTab if selectedTab: (name, directory) = self.paths[self.tabControl.SelectedIndex] image = selectedTab.Controls[0].image saveFileDialog = SaveFileDialog() saveFileDialog.Filter = FILTER if directory is not None: saveFileDialog.InitialDirectory = directory saveFileDialog.FileName = name if saveFileDialog.ShowDialog() == DialogResult.OK: fileName = saveFileDialog.FileName extension = Path.GetExtension(fileName) format = IMAGEFORMATS.get(extension.lower()) if format is None: format = ImageFormat.Jpeg fileName += '.jpg' try: image.Save(fileName, format) except Exception, e: MessageBox.Show("Problem Saving %s.\r\nError: %s" % (fileName, str(e)), "Problem Saving File", MessageBoxButtons.OK, MessageBoxIcon.Error) name = Path.GetFileName(fileName) selectedTab.Text = name self.paths[self.tabControl.SelectedIndex] = (name, Path.GetDirectoryName(fileName))
def SaveAsToolStripMenuItemClick(self, sender, e): saveAsDialog = SaveFileDialog() saveAsDialog.Filter = 'Data Manager rule set (*.dat)|*.dat' if saveAsDialog.ShowDialog() == DialogResult.OK: self.writeRuleFile() self.loadGroups() try: File.Copy(globalvars.DATFILE,saveAsDialog.FileName) except Exception, err: MessageBox.Show('Could not save file.\n%s' % str(err), 'Data Manager for ComicRack %s' % self.theVersion)
def do_save_dialogs(): dlg = SaveFileDialog() dlg.Title = "Save Column Settings" dlg.FileName = "Column Export" dlg.Filter = 'MahTweets Settings (*.mahtweets) | *.mahtweets' dlg.DefaultExt = ".mahtweets" if dlg.ShowDialog() == DialogResult.OK: return dlg.FileName else: return None
def shot_BT_Click(self, sender, e): dialog = SaveFileDialog() dialog.Filter = "Image(*.png)|*.png" dialog.FileName = self.quantity_CB.Text + '_' + self.plane + '_' + str( self.position_SB.Value) if dialog.ShowDialog() == DialogResult.OK: options = [ 'NAME:SaveImageParams', 'ShowAxis:=', 'Default', 'ShowGrid:=', 'Default', 'ShowRuler:=', 'Default' ] oEditor.ExportModelImageToFile(dialog.FileName, 1200, 900, options)
def fn(self, sender, e): dialog = SaveFileDialog() dialog.Filter = "PNG or BMP or Tif files(*.png,*.bmp,*.tif)|*.png;*.tif;*.bmp" dialog.ShowDialog() if dialog.OnFileOk: if dialog.FileName != "": data = dialog.FileName self.n1.Text = data MessageBox.Show("Choose the 'second noise' panel","Note!",MessageBoxButton.OK, MessageBoxImage.Information) self.f_panel.IsEnabled = False self.s_panel.IsEnabled = True self.s_panel.IsSelected = True self.panel = "s" f = open("Text/input.txt","a") f.write(str(data)+"\n") f.close() self.input1 = data pass
def sn(self, sender, e): dialog = SaveFileDialog() dialog.Filter = "PNG or BMP or Tif files(*.png,*.bmp,*.tif)|*.png;*.tif;*.bmp" dialog.ShowDialog() if dialog.OnFileOk: if dialog.FileName != "": data = dialog.FileName self.n2.Text = data MessageBox.Show("Wait for responding","Note!",MessageBoxButton.OK, MessageBoxImage.Information) self.s_panel.IsEnabled = False f = open("Text/input.txt","a") f.write(str(data)+"\n") f.close() self.input2 = data dir = os.getcwd() f = open("Text/input.txt","w") f.write("") data1 = self.input1 data2 = self.input2 f.write(data1+"\n"+data2+"\n") f.close() dir = os.getcwd() dir3 = dir + "\\files\\g\\dist\\picsaz.exe" #p = subprocess.Popen(py_dir + "\python.exe " + dir + "\\picsaz.py",shell=True) p = subprocess.Popen(dir3,shell=True) p.wait() #delay(2) dir3 = dir + "\\files\\l\\dist\\transparent1.exe" #p = subprocess.Popen(py_dir + "\python.exe " + dir + "\\transparent1.py",shell=True) p = subprocess.Popen(dir3,shell=True) p.wait() #delay(1) #os.system(py_dir + "\python.exe " + dir + "\\picsaz.py") #os.system(py_dir + "\python.exe " + dir + "\\transparent1.py") os.system(dir + "\\Show_Pictures1.exe") #f = open("Text/picsaz.txt","w") #f.write("") #f = open("Text/input.txt","w") #f.write("") pass
def save_file(file_ext='', files_filter='', init_dir='', default_name='', restore_dir=True, unc_paths=False): sf_dlg = SaveFileDialog() if files_filter: sf_dlg.Filter = files_filter else: sf_dlg.Filter = '|*.{}'.format(file_ext) sf_dlg.RestoreDirectory = restore_dir if init_dir: sf_dlg.InitialDirectory = init_dir # setting default filename sf_dlg.FileName = default_name if sf_dlg.ShowDialog() == DialogResult.OK: if unc_paths: return dletter_to_unc(sf_dlg.FileName) return sf_dlg.FileName
def SaveLog(self): try: save = SaveFileDialog() save.AddExtension = True save.Filter = "Text files (*.txt)|*.txt" if save.ShowDialog() == DialogResult.OK: with open(save.FileName, 'w') as f: f.write("Library Organizer Report:\n\n" + self.header) for array in self._log: f.write("\n\n%s:\n%s: %s" % (array[0], array[1], array[2])) if array[3] != "": f.write("\nMessage: " + array[3]) save.Dispose() except Exception, ex: MessageBox.Show( "something went wrong saving the file. The error was: " + str(ex))
def dosave(): dialog = SaveFileDialog() dialog.FileName="cvs-debug-log-" + \ DateTime.Today.ToString("yyyy-MM-dd") + ".txt" dialog.Title = i18n.get("LogSaveTitle") dialog.Filter = i18n.get("LogSaveFilter")+'|*.*' try: if dialog.ShowDialog(__app_window) == DialogResult.OK: if dialog.FileName != None: debug("wrote debug logfile: ", FileInfo(dialog.FileName).Name) __logger.save(dialog.FileName) if show_error_message: MessageBox.Show(__app_window, i18n.get("LogSavedText"), i18n.get("LogSavedTitle"), MessageBoxButtons.OK, MessageBoxIcon.Information ) except: debug_exc() MessageBox.Show( __app_window, i18n.get("LogSaveFailedText") )
GNU General Public License for more details. See this link for a copy of the GNU General Public License protecting this package. https://github.com/eirannejad/pyRevit/blob/master/LICENSE ''' __window__.Close() import clr clr.AddReference('System.Windows.Forms') from System.Windows.Forms import DialogResult, SaveFileDialog from Autodesk.Revit.DB import ImageExportOptions, ExportRange, ImageFileType, ImageResolution, ZoomFitType doc = __revit__.ActiveUIDocument.Document # collect file location from user dialog = SaveFileDialog() dialog.Title = 'Export current view as PNG' dialog.Filter = 'PNG files (*.PNG)|*.PNG' if dialog.ShowDialog() == DialogResult.OK: # set up the export options options = ImageExportOptions() options.ExportRange = ExportRange.VisibleRegionOfCurrentView options.FilePath = dialog.FileName options.HLRandWFViewsFileType = ImageFileType.PNG options.ImageResolution = ImageResolution.DPI_600 options.ZoomType = ZoomFitType.Zoom options.ShadowViewsFileType = ImageFileType.PNG doc.ExportImage(options)
def Save_File_dialog(self): dialog = SaveFileDialog() dialog.Filter = self.filter if dialog.ShowDialog() == DialogResult.OK: return open(dialog.FileName, "w+") return False
import sys import clr clr.AddReference("System.Windows.Forms") from System.Windows.Forms import DialogResult, SaveFileDialog dialog = SaveFileDialog() dialog.Filter = "text files (*.txt)|*.txt" if dialog.ShowDialog() == DialogResult.OK: txt_path = dialog.FileName AddWarningMessage(txt_path) else: sys.exit()