• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python file_dialog.FileDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyface.file_dialog.FileDialog的典型用法代码示例。如果您正苦于以下问题:Python FileDialog类的具体用法?Python FileDialog怎么用?Python FileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了FileDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _open_logfiles_fired

 def _open_logfiles_fired(self):
   dlg = FileDialog()
   dlg.action = 'open files'
   if dlg.open() == OK:
       paths = dlg.paths
       for filePath in paths:
         self.log_files.append(filePath)
开发者ID:kr2,项目名称:TouchIT-Log,代码行数:7,代码来源:FileSelect.py


示例2: get_file_path

def get_file_path(root, action='open'):
    dlg = FileDialog(action=action,
                     wildcard=FileDialog.create_wildcard('YAML', '*.yaml *.yml'),
                     default_directory=root)
    if dlg.open():
        if dlg.path:
            return dlg.path
开发者ID:OSUPychron,项目名称:pychron,代码行数:7,代码来源:conditionals_edit_view.py


示例3: make_gosub

    def make_gosub(self):
        selection = self.control.code.textCursor().selectedText()
        dlg = FileDialog(action='save as',
                         default_directory=os.path.dirname(self.path))

        p = None
        # root = os.path.dirname(self.path)
        # p = os.path.join(root, 'common', 'test_gosub.py')
        if dlg.open():
            p = dlg.path

        if p:
            p = add_extension(p, '.py')
            # p='/Users/ross/Desktop/foosub.py'
            with open(p, 'w') as wfile:
                wfile.write('# Extracted Gosub\n')
                wfile.write('# Source: from {}\n'.format(self.path))
                wfile.write('# Date: {}\n'.format(datetime.now().strftime('%m-%d-%Y %H:%M')))
                wfile.write('def main():\n')
                for li in selection.split(u'\u2029'):
                    wfile.write(u'    {}\n'.format(li.lstrip()))

            p = remove_extension(p)
            rp = os.path.relpath(p, self.path)
            rp = rp.replace('/', ':')
            self.control.code.replace_selection("gosub('{}')".format(rp[3:]))
开发者ID:NMGRL,项目名称:pychron,代码行数:26,代码来源:pyscript_editor.py


示例4: configure

    def configure(self, pre_run=False, **kw):
        if not pre_run:
            self._manual_configured = True

        if not self.path or not os.path.isfile(self.path):
            msg = '''CSV File Format
Create/select a file with a column header as the first line. 
The following columns are required:

runid, age, age_err

Optional columns are:

group, aliquot

e.x.
runid, age, age_error
SampleA, 10, 0.24
SampleB, 11, 0.32
SampleC, 10, 0.40'''
            information(None, msg)

            dlg = FileDialog()
            if dlg.open() == OK:
                self.path = dlg.path

        return bool(self.path)
开发者ID:NMGRL,项目名称:pychron,代码行数:27,代码来源:data.py


示例5: save_as

 def save_as(self):
     dlg = FileDialog(action='save as',
                      default_directory=paths.extraction_dir)
     if dlg.open() == OK:
         p = dlg.path
         if p:
             self._save(p)
开发者ID:NMGRL,项目名称:pychron,代码行数:7,代码来源:extraction_line_script_writer.py


示例6: _open_button_fired

    def _open_button_fired(self):
        self.data_selectors = []
        #        p = '/Users/ross/Sandbox/csvdata.txt'
        #        self._path = p
        #        self._path=os.path.join(paths.data_dir,'spectrometer_scans','scan007.txt')
        dlg = FileDialog(action='open', default_directory=paths.data_dir)
        if dlg.open() == OK:
            self._path = dlg.path

        with open(self._path, 'U') as fp:


            reader = csv.reader(fp, delimiter=self.delimiter)
            self.column_names = names = reader.next()
            try:
                cs = DataSelector(column_names=names,
                                  index=names[0],
                                  value=names[1],
                                  removable=False,
                                  parent=self,
                )
                self.data_selectors.append(cs)
            except IndexError:

                self.warning_dialog('Invalid delimiter {} for {}'.format(DELIMITERS[self.delimiter],
                                                                         os.path.basename(self._path)
                ))
开发者ID:jirhiker,项目名称:pychron,代码行数:27,代码来源:csv_grapher.py


示例7: _open_esffiles_fired

 def _open_esffiles_fired(self):
   dlg = FileDialog()
   dlg.wildcard = "*.esf"
   dlg.action = 'open files'
   if dlg.open() == OK:
       paths = dlg.paths
       for filePath in paths:
         self.esf_files.append(filePath)
开发者ID:kr2,项目名称:TouchIT-Log,代码行数:8,代码来源:FileSelect.py


示例8: _get_save_path

    def _get_save_path(self, path, ext='.pdf'):
        if path is None:
            dlg = FileDialog(action='save as', default_directory=paths.processed_dir)
            if dlg.open():
                if dlg.path:
                    path = add_extension(dlg.path, ext)

        return path
开发者ID:OSUPychron,项目名称:pychron,代码行数:8,代码来源:base_table_editor.py


示例9: get_path

 def get_path():
     return '/Users/ross/Sandbox/exporttest2.db'
     dlg = FileDialog(action='open',
                      default_directory=paths.data_dir,
                      wildcard='*.db')
     if dlg.open():
         if dlg.path:
             return dlg.path
开发者ID:OSUPychron,项目名称:pychron,代码行数:8,代码来源:processor.py


示例10: _open_fired

    def _open_fired(self):
        dlg = FileDialog(action='open')
        if dlg.open() == OK:
            with open(dlg.path, 'rb') as fp:
                self.viewer.set_image(fp)
                self.hierarchy.files.append(os.path.basename(dlg.path))

            self.client.cache(dlg.path)
开发者ID:softtrainee,项目名称:arlab,代码行数:8,代码来源:browser.py


示例11: open_file

 def open_file(self, p=''):
     if not os.path.isfile(p):
         dlg = FileDialog(action='open', default_directory=paths.extraction_dir)
         if dlg.open() == OK and dlg.path:
             p = dlg.path
     if p:
         self._open_file(p)
         return True
开发者ID:NMGRL,项目名称:pychron,代码行数:8,代码来源:extraction_line_script_writer.py


示例12: save_as

 def save_as(self):
     if self._validate_sequence():
         dialog = FileDialog(action='save as', default_directory=paths.hops_dir)
         if dialog.open() == OK:
             p = dialog.path
             p = add_extension(p, '.txt')
             self._save_file(p)
             self.path = p
开发者ID:UManPychron,项目名称:pychron,代码行数:8,代码来源:hops_editor.py


示例13: _getFilePath

 def _getFilePath(self, defFileName):
     dlg = FileDialog()
     dlg.action = 'save as'
     dlg.default_filename = defFileName
     if dlg.open() == OK:
         return dlg.path
     else:
         return None
开发者ID:kr2,项目名称:TouchIT-Log,代码行数:8,代码来源:Plot.py


示例14: _exportCSV_changed

  def _exportCSV_changed(self):
    dlg = FileDialog()
    dlg.action = 'save as'
    dlg.default_filename = self.groupAddress.replace("/", "-") + '_' + self.name + '.csv'
    if dlg.open() != OK:
      return

    if self._exportCSV_hock != None:
      self._exportCSV_hock(self, dlg.path)
开发者ID:kr2,项目名称:TouchIT-Log,代码行数:9,代码来源:Tree.py


示例15: _add_tray_button_fired

 def _add_tray_button_fired(self):
     dlg = FileDialog(action='open', default_directory=paths.irradiation_tray_maps_dir)
     if dlg.open() == OK:
         if dlg.path:
             # verify this is a valid irradiation map file
             if parse_irradiation_tray_map(dlg.path) is not None:
                 db = self.db
                 load_irradiation_map(db, dlg.path,
                                      os.path.basename(dlg.path), overwrite_geometry=True)
开发者ID:NMGRL,项目名称:pychron,代码行数:9,代码来源:level_editor.py


示例16: save_file_dialog

 def save_file_dialog(self, ext=None, **kw):
     if "default_directory" not in kw:
         kw["default_directory"] = self.default_directory
     dialog = FileDialog(parent=self.window.control, action="save as", **kw)
     if dialog.open() == OK:
         path = dialog.path
         if path:
             if ext is None:
                 ext = self._default_extension
             return add_extension(path, ext=ext)
开发者ID:NMGRL,项目名称:pychron,代码行数:10,代码来源:base_task.py


示例17: _save_fired

 def _save_fired(self):
     dlg = FileDialog(default_directory=paths.root_dir,
                      action='save as'
                      )
     if dlg.open() == OK:
         self.info('saving results to {}'.format(dlg.path))
         with open(dlg.path, 'w') as f:
             f.write('name = {} id = {}\n'.format(self.axis.name, self.axis.id))
             for r in self.results:
                 f.write(r.tostring())
开发者ID:softtrainee,项目名称:arlab,代码行数:10,代码来源:results_report.py


示例18: _save_button_fired

    def _save_button_fired(self):
        from pyface.file_dialog import FileDialog
        dialog = FileDialog(action='save as',
                            default_directory=os.path.join(os.path.expanduser('~')))

        from pyface.constant import OK
        if dialog.open() == OK:
            path = dialog.path
            if path:
                self.selected_image.save(add_extension(path, '.jpg'))
开发者ID:NMGRL,项目名称:pychron,代码行数:10,代码来源:viewer.py


示例19: _save_as_button_fired

    def _save_as_button_fired(self):
        dlg = FileDialog(action='save as',
                         default_directory=paths.incremental_heat_template_dir)
        if dlg.open() == OK:
            path = dlg.path
            if not path.endswith('.txt'):
                path = '{}.txt'.format(path)

            self.dump(path)
            self.path = path
            self.close_ui()
开发者ID:UManPychron,项目名称:pychron,代码行数:11,代码来源:increment_heat_template.py


示例20: _save_button_fired

    def _save_button_fired(self):
        dlg = FileDialog(action='save as')
        if dlg.open() == OK:
            path = dlg.path
            if self.save_mode == 'orig':
                p = self.oplot
            elif self.save_mode == 'thresh':
                p = self.plot
            else:
                p = self.container

            self.render_pdf(p, path)
开发者ID:OSUPychron,项目名称:pychron,代码行数:12,代码来源:bandwidth_imager.py



注:本文中的pyface.file_dialog.FileDialog类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python gui.GUI类代码示例发布时间:2022-05-25
下一篇:
Python api.GUI类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap