Changeset 1176137 in sasview for src/sas/sascalc


Ignore:
Timestamp:
Apr 17, 2018 9:29:25 AM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
666454e, 1cf490b6, cd10013, c192960
Parents:
94f074c4 (diff), 91552b5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Butler <butlerpd@…> (04/17/18 09:29:25)
git-committer:
GitHub <noreply@…> (04/17/18 09:29:25)
Message:

Merge pull request #149 from SasView?/ticket-1079

Removing save button from OSX

closes #1079

Location:
src/sas/sascalc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/fit/pagestate.py

    r9e6aeaf r3b070a0  
    646646                    name = value.split(':', 1)[1].strip() 
    647647                    file_value = "File name:" + name 
     648                    #Truncating string so print doesn't complain of being outside margins 
     649                    if sys.platform != "win32": 
     650                        MAX_STRING_LENGHT = 50 
     651                        if len(file_value) > MAX_STRING_LENGHT: 
     652                            file_value = "File name:.."+file_value[-MAX_STRING_LENGHT+10:] 
    648653                    file_name = CENTRE % file_value 
    649654                    if len(title) == 0: 
     
    721726        html_str, text_str, title = self._get_report_string() 
    722727        # Allow 2 figures to append 
    723         image_links = [FEET_2%fig for fig in fig_urls] 
    724  
     728        #Constraining image width for OSX and linux, so print doesn't complain of being outside margins 
     729        if sys.platform == "win32": 
     730            image_links = [FEET_2%fig for fig in fig_urls] 
     731        else: 
     732            image_links = [FEET_2_unix%fig for fig in fig_urls] 
    725733        # final report html strings 
    726734        report_str = html_str + ELINE.join(image_links) 
    727  
     735        report_str += FEET_3 
    728736        return report_str, text_str 
    729737 
     
    13681376""" 
    13691377FEET_2 = \ 
    1370 """<img src="%s" ></img> 
     1378"""<img src="%s"></img> 
     1379""" 
     1380FEET_2_unix = \ 
     1381"""<img src="%s" width="540"></img> 
    13711382""" 
    13721383FEET_3 = \ 
  • src/sas/sascalc/dataloader/file_reader_base_class.py

    ra58b5a0 r4a8d55c  
    3131FIELDS_2D = ('data', 'qx_data', 'qy_data', 'q_data', 'err_data', 
    3232                 'dqx_data', 'dqy_data', 'mask') 
    33  
     33DEPRECATION_MESSAGE = ("\rThe extension of this file suggests the data set migh" 
     34                       "t not be fully reduced. Support for the reader associat" 
     35                       "ed with this file type has been removed. An attempt to " 
     36                       "load the file was made, but, should it be successful, " 
     37                       "SasView cannot guarantee the accuracy of the data.") 
    3438 
    3539class FileReader(object): 
     
    4044    # List of allowed extensions 
    4145    ext = ['.txt'] 
     46    # Deprecated extensions 
     47    deprecated_extensions = ['.asc', '.nxs'] 
    4248    # Bypass extension check and try to load anyway 
    4349    allow_all = False 
     
    8793                    if not self.f_open.closed: 
    8894                        self.f_open.close() 
     95                    if any(filepath.lower().endswith(ext) for ext in 
     96                           self.deprecated_extensions): 
     97                        self.handle_error_message(DEPRECATION_MESSAGE) 
    8998                    if len(self.output) > 0: 
    9099                        # Sort the data that's been loaded 
     
    146155        else: 
    147156            logger.warning(msg) 
     157            raise NoKnownLoaderException(msg) 
    148158 
    149159    def send_to_output(self): 
  • src/sas/sascalc/dataloader/loader.py

    rdc8d1c2 r4a8d55c  
    9090            ascii_loader = ascii_reader.Reader() 
    9191            return ascii_loader.read(path) 
     92        except NoKnownLoaderException: 
     93            pass  # Try the Cansas XML reader 
    9294        except DefaultReaderException: 
    9395            pass  # Loader specific error to try the cansas XML reader 
     
    100102            cansas_loader = cansas_reader.Reader() 
    101103            return cansas_loader.read(path) 
     104        except NoKnownLoaderException: 
     105            pass  # Try the NXcanSAS reader 
    102106        except DefaultReaderException: 
    103107            pass  # Loader specific error to try the NXcanSAS reader 
Note: See TracChangeset for help on using the changeset viewer.