Changeset 3b3b40b in sasview for src/sas/qtgui/Utilities/GuiUtils.py


Ignore:
Timestamp:
Mar 21, 2018 4:17:04 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
8b480d27
Parents:
e4c475b7
git-author:
Piotr Rozyczko <rozyczko@…> (02/08/18 04:19:04)
git-committer:
Piotr Rozyczko <rozyczko@…> (03/21/18 04:17:04)
Message:

Merging feature branches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/GuiUtils.py

    r63319b0 r3b3b40b  
    213213    plotRequestedSignal = QtCore.pyqtSignal(list) 
    214214 
     215    # Plot from file names 
     216    plotFromFilenameSignal = QtCore.pyqtSignal(str) 
     217 
    215218    # Plot update requested from a perspective 
    216219    plotUpdateSignal = QtCore.pyqtSignal(list) 
     
    236239    # Send result of Data Operation Utility panel to Data Explorer 
    237240    updateModelFromDataOperationPanelSignal = QtCore.pyqtSignal(QtGui.QStandardItem, dict) 
     241 
     242    # Notify about a new custom plugin being written/deleted/modified 
     243    customModelDirectoryChanged = QtCore.pyqtSignal() 
    238244 
    239245def updateModelItemWithPlot(item, update_data, name=""): 
     
    872878        raise TypeError 
    873879 
     880def findNextFilename(filename, directory): 
     881    """ 
     882    Finds the next available (non-existing) name for 'filename' in 'directory'. 
     883    plugin.py -> plugin (n).py  - for first 'n' for which the file doesn't exist 
     884    """ 
     885    basename, ext = os.path.splitext(filename) 
     886    # limit the number of copies 
     887    MAX_FILENAMES = 1000 
     888    # Start with (1) 
     889    number_ext = 1 
     890    proposed_filename = "" 
     891    found_filename = False 
     892    # Find the next available filename or exit if too many copies 
     893    while not found_filename or number_ext > MAX_FILENAMES: 
     894        proposed_filename = basename + " ("+str(number_ext)+")" + ext 
     895        if os.path.exists(os.path.join(directory, proposed_filename)): 
     896            number_ext += 1 
     897        else: 
     898            found_filename = True 
     899 
     900    return proposed_filename 
     901 
     902 
    874903class DoubleValidator(QtGui.QDoubleValidator): 
    875904    """ 
Note: See TracChangeset for help on using the changeset viewer.