Changeset 619 for trunk/GSASII.py


Ignore:
Timestamp:
May 17, 2012 11:03:40 AM (11 years ago)
Author:
toby
Message:

tweak import more

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r618 r619  
    325325                    for i in range(3):
    326326                        rdmsg += fp.readline()
    327                     rdmsg += '...'
    328                     if all(16 < ord(c) < 128 for c in rdmsg): # show only if ASCII
    329                         result = wx.ID_NO
    330                         # it would be better to use something that
    331                         # would resize better, but this will do for now
    332                         dlg = wx.MessageDialog(
    333                             self, rdmsg,
    334                             'Is this the file you want?',
    335                             wx.YES_NO | wx.ICON_QUESTION,
    336                             )
    337                         dlg.SetSize((700,300)) # does not resize on Mac
    338                         try:
    339                             result = dlg.ShowModal()
    340                         finally:
    341                             dlg.Destroy()
    342                             if result == wx.ID_NO: return []
     327                    rdmsg += '\n\nDo you want to read this file?'
     328                    if not all([ord(c) < 128 for c in rdmsg]): # show only if ASCII
     329                        rdmsg = 'File '+str(
     330                            filename)+' is a binary file. Do you want to read this file?'
     331                    result = wx.ID_NO
     332                    # it would be better to use something that
     333                    # would resize better, but this will do for now
     334                    dlg = wx.MessageDialog(
     335                        self, rdmsg,
     336                        'Is this the file you want?',
     337                        wx.YES_NO | wx.ICON_QUESTION,
     338                        )
     339                    dlg.SetSize((700,300)) # does not resize on Mac
     340                    try:
     341                        result = dlg.ShowModal()
     342                    finally:
     343                        dlg.Destroy()
     344                    if result == wx.ID_NO: return []
    343345                           
    344346                self.lastimport = filename
Note: See TracChangeset for help on using the changeset viewer.