Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
be1495e
Be ready for dark mode
vasole Feb 13, 2026
08fe2b7
Be ready for dark mode
vasole Feb 13, 2026
a59ad86
Prepare the periodic table for dark mode
vasole Feb 13, 2026
19ba3e1
Outline was lost.
vasole Feb 13, 2026
dd82158
start digging into the Dark
sergey-yaroslavtsev Feb 13, 2026
0e7ede2
one more step to the Dark
sergey-yaroslavtsev Feb 13, 2026
d32120e
finalizing acceptance of dark mode
sergey-yaroslavtsev Feb 13, 2026
6942460
qt.QPalette(self.palette()) everywhere, modify QPereodicTable and Fit…
sergey-yaroslavtsev Feb 16, 2026
c6aa0a6
cleaning legacy code for Qt<5, since it is not supported anymore
sergey-yaroslavtsev Feb 16, 2026
f780142
More cleaning
sergey-yaroslavtsev Feb 16, 2026
4beb442
remove complexity, magenta-black-selected for EnergyTable, fix of HTM…
sergey-yaroslavtsev Feb 17, 2026
67018bf
return red text to FitPeakSelect, highlights to PeakIdentifier table
sergey-yaroslavtsev Feb 18, 2026
0cacf71
proper patch of colors to remove try/except
sergey-yaroslavtsev Feb 18, 2026
12e95ee
mistake in color for FitPeakSelect - now value is red not the name
sergey-yaroslavtsev Feb 18, 2026
687f1a5
QWizard style, EnergyTable checkbox issue
sergey-yaroslavtsev Feb 18, 2026
9cd83ab
Initialize style on build QPereodicTable, fix nan button srtyle in RG…
sergey-yaroslavtsev Feb 19, 2026
ea383e8
HDF5 qwizard fixed, energy table seelctor switch to acceptable versio…
sergey-yaroslavtsev Feb 23, 2026
020e451
parse icons for dark mode and avoid modification of toolbar bg
sergey-yaroslavtsev Feb 23, 2026
c2d2389
use lightness instead of text color. MacOS dark mode is strange
sergey-yaroslavtsev Feb 24, 2026
daa9113
background color fix for nan button in RGBCorrelator for MacOS
sergey-yaroslavtsev Feb 24, 2026
c11d982
remove remaining try/except
sergey-yaroslavtsev Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/_WindowsExe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
pip install $(python -c "import glob; print(' '.join(glob.glob('wheels/*cp313*.whl')))")
pip install Cython
pip install numpy==2.2.6
pip install Pyside6==6.9.1
pip install Pyside6==6.8.3
pip install h5py
pip install fisx
pip install hdf5plugin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_WindowsInstaller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
pip install $(python -c "import glob; print(' '.join(glob.glob('wheels/*cp313*.whl')))")
pip install Cython
pip install numpy==2.2.6
pip install Pyside6==6.9.1
pip install Pyside6==6.8.3
pip install h5py
pip install fisx
pip install hdf5plugin
Expand Down
8 changes: 8 additions & 0 deletions src/PyMca5/PyMcaGui/PyMcaQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,10 @@ def patch_enums(*modules):
QPalette.Button = QPalette.ColorRole.Button
QPalette.ButtonText = QPalette.ColorRole.ButtonText
QPalette.BrightText = QPalette.ColorRole.BrightText
QPalette.Highlight = QPalette.ColorRole.Highlight
QPalette.Shadow = QPalette.ColorRole.Shadow
QPalette.Midlight = QPalette.ColorRole.Midlight
QPalette.Link = QPalette.ColorRole.Link

try:
from silx.gui import qt as SilxQt
Expand All @@ -399,6 +403,10 @@ def patch_enums(*modules):
SilxQt.QPalette.Button = SilxQt.QPalette.ColorRole.Button
SilxQt.QPalette.ButtonText = SilxQt.QPalette.ColorRole.ButtonText
SilxQt.QPalette.BrightText = SilxQt.QPalette.ColorRole.BrightText
SilxQt.QPalette.Highlight = SilxQt.QPalette.ColorRole.Highlight
SilxQt.QPalette.Shadow = SilxQt.QPalette.ColorRole.Shadow
SilxQt.QPalette.Midlight = SilxQt.QPalette.ColorRole.Midlight
SilxQt.QPalette.Link = SilxQt.QPalette.ColorRole.Link
except Exception:
_logger.info("Exception patching silx")
pass
Expand Down
54 changes: 13 additions & 41 deletions src/PyMca5/PyMcaGui/io/PyMcaFileDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,7 @@ def getFileList(parent=None, filetypelist=None, message=None, currentdir=None,
nativeFileDialogs = native
if getfilter is None:
getfilter = False
if getfilter:
if QTVERSION < '4.5.1':
native_possible = False
else:
native_possible = True
else:
native_possible = True
native_possible = True
filterused = None
if native_possible and nativeFileDialogs:
filetypes = currentfilter
Expand Down Expand Up @@ -164,16 +158,10 @@ def getFileList(parent=None, filetypelist=None, message=None, currentdir=None,
currentfilter)
filterused = qt.safe_str(filterused)
else:
if QTVERSION < '5.0.0':
filelist = qt.QFileDialog.getSaveFileNameAndFilter(parent,
message,
wdir,
filetypes)
else:
filelist = qt.QFileDialog.getSaveFileName(parent,
message,
wdir,
filetypes)
filelist = qt.QFileDialog.getSaveFileName(parent,
message,
wdir,
filetypes)
if len(filelist[0]):
filterused = qt.safe_str(filelist[1])
filelist=[filelist[0]]
Expand All @@ -182,33 +170,21 @@ def getFileList(parent=None, filetypelist=None, message=None, currentdir=None,
else:
if mode == "OPEN":
if single:
if QTVERSION < '5.0.0':
filelist = [qt.QFileDialog.getOpenFileName(parent,
filelist, filterused = qt.QFileDialog.getOpenFileName(parent,
message,
wdir,
filetypes)]
else:
filelist, filterused = qt.QFileDialog.getOpenFileName(parent,
message,
wdir,
filetypes)
filelist = [filelist]
filetypes)
filelist = [filelist]
else:
filelist = qt.QFileDialog.getOpenFileNames(parent,
message,
wdir,
filetypes)
else:
if QTVERSION < '5.0.0':
filelist = qt.QFileDialog.getSaveFileName(parent,
filelist, filterused = qt.QFileDialog.getSaveFileName(parent,
message,
wdir,
filetypes)
else:
filelist, filterused = qt.QFileDialog.getSaveFileName(parent,
message,
wdir,
filetypes)
filelist = qt.safe_str(filelist)
if len(filelist):
filelist = [filelist]
Expand Down Expand Up @@ -253,10 +229,9 @@ def getFileList(parent=None, filetypelist=None, message=None, currentdir=None,
fdialog.setFileMode(qt.QFileDialog.FileMode.AnyFile)

fdialog.setDirectory(wdir)
if QTVERSION > '4.3.0':
history = fdialog.history()
if len(history) > 6:
fdialog.setHistory(history[-6:])
history = fdialog.history()
if len(history) > 6:
fdialog.setHistory(history[-6:])
ret = fdialog.exec()
if ret != qt.QDialog.Accepted:
fdialog.close()
Expand All @@ -269,10 +244,7 @@ def getFileList(parent=None, filetypelist=None, message=None, currentdir=None,
filelist = fdialog.selectedFiles()
if single:
filelist = [filelist[0]]
if QTVERSION < "5.0.0":
filterused = qt.safe_str(fdialog.selectedFilter())
else:
filterused = qt.safe_str(fdialog.selectedNameFilter())
filterused = qt.safe_str(fdialog.selectedNameFilter())
if mode != "OPEN":
if "." in filterused:
extension = filterused.replace(")", "")
Expand Down
120 changes: 46 additions & 74 deletions src/PyMca5/PyMcaGui/io/QSpecFileWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,14 @@

QTVERSION = qt.qVersion()

if QTVERSION > '4.2.0':
class MyQTreeWidgetItem(qt.QTreeWidgetItem):
def __lt__(self, other):
c = self.treeWidget().sortColumn()
if c == 0:
return False
if c != 2:
return (float(self.text(c)) < float(other.text(c)))
return (self.text(c) < other.text(c))
else:
MyQTreeWidgetItem = qt.QTreeWidgetItem
class MyQTreeWidgetItem(qt.QTreeWidgetItem):
def __lt__(self, other):
c = self.treeWidget().sortColumn()
if c == 0:
return False
if c != 2:
return (float(self.text(c)) < float(other.text(c)))
return (self.text(c) < other.text(c))

#class QSpecFileWidget(qt.QWidget):
class QSpecFileWidget(QSelectorWidget.QSelectorWidget):
Expand Down Expand Up @@ -145,36 +142,22 @@ def _build(self):
#self.list.header().resizeSection(4, size)

self.list.header().setStretchLastSection(False)
if QTVERSION > '5.0.0':
self.list.header().setSectionResizeMode(0, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(1, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(2, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(3, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(4, qt.QHeaderView.Interactive)
fm = self.list.header().fontMetrics()
if hasattr(fm, "width"):
size = fm.width("X")
else:
size = fm.maxWidth()
self.list.header().setMinimumSectionSize(size)
self.list.header().resizeSection(0, size)
# self.list.header().resizeSection(1, size * 4)
self.list.header().resizeSection(2, size * 25)
# self.list.header().resizeSection(3, size * 7)
# self.list.header().resizeSection(4, size * 8)

elif QTVERSION < '4.2.0':
self.list.header().setResizeMode(0, qt.QHeaderView.Stretch)
self.list.header().setResizeMode(1, qt.QHeaderView.Stretch)
self.list.header().setResizeMode(2, qt.QHeaderView.Interactive)
self.list.header().setResizeMode(3, qt.QHeaderView.Stretch)
self.list.header().setResizeMode(4, qt.QHeaderView.Stretch)
self.list.header().setSectionResizeMode(0, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(1, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(2, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(3, qt.QHeaderView.Interactive)
self.list.header().setSectionResizeMode(4, qt.QHeaderView.Interactive)
fm = self.list.header().fontMetrics()
if hasattr(fm, "width"):
size = fm.width("X")
else:
self.list.header().setResizeMode(0, qt.QHeaderView.ResizeToContents)
self.list.header().setResizeMode(1, qt.QHeaderView.ResizeToContents)
self.list.header().setResizeMode(2, qt.QHeaderView.Interactive)
self.list.header().setResizeMode(3, qt.QHeaderView.ResizeToContents)
self.list.header().setResizeMode(4, qt.QHeaderView.ResizeToContents)
size = fm.maxWidth()
self.list.header().setMinimumSectionSize(size)
self.list.header().resizeSection(0, size)
# self.list.header().resizeSection(1, size * 4)
self.list.header().resizeSection(2, size * 25)
# self.list.header().resizeSection(3, size * 7)
# self.list.header().resizeSection(4, size * 8)

# --- signal handling
self.list.itemSelectionChanged.connect(self.__selectionChanged)
Expand All @@ -186,10 +169,9 @@ def _build(self):
self.__doubleClicked)
self.cntTable.sigSpecFileCntTableSignal.connect(self._cntSignal)

if QTVERSION > '4.2.0':
self.list.setSortingEnabled(False)
self.list.header().sectionDoubleClicked[int].connect( \
self.__headerSectionDoubleClicked)
self.list.setSortingEnabled(False)
self.list.header().sectionDoubleClicked[int].connect( \
self.__headerSectionDoubleClicked)
if OBJECT3D:
self.object3DBox.clicked.connect(self._setObject3DBox)
if hasattr(self, 'meshBox'):
Expand All @@ -207,13 +189,10 @@ def _build(self):
self.disableScan = 0 #(type=="mca")

# -- last scan watcher
if QTVERSION > '5.0.0':
self.lastScanWatcher = qt.QTimer()
self.lastScanWatcher.setSingleShot(True)
self.lastScanWatcher.setInterval(2000) # 2 seconds
self.lastScanWatcher.timeout.connect(self._timerSlot)
else:
self.lastScanWatcher = None
self.lastScanWatcher = qt.QTimer()
self.lastScanWatcher.setSingleShot(True)
self.lastScanWatcher.setInterval(2000) # 2 seconds
self.lastScanWatcher.timeout.connect(self._timerSlot)

# --- context menu
self.data= None
Expand Down Expand Up @@ -344,12 +323,11 @@ def refresh(self):
self.scans.append(sn)
after= item
i = i + 1
if QTVERSION > '5.0.0':
self.list.resizeColumnToContents(0)
self.list.resizeColumnToContents(1)
#self.list.resizeColumnToContents(2)
self.list.resizeColumnToContents(3)
self.list.resizeColumnToContents(4)
self.list.resizeColumnToContents(0)
self.list.resizeColumnToContents(1)
#self.list.resizeColumnToContents(2)
self.list.resizeColumnToContents(3)
self.list.resizeColumnToContents(4)

def clear(self):
self.list.clear()
Expand Down Expand Up @@ -470,11 +448,10 @@ def _timerSlot(self):
if updated:
self.data.refresh()
self.refresh()
if QTVERSION > "5.0.0":
# make sure the item is found and selected after the update
itemList = self.list.findItems(scan, qt.Qt.MatchExactly,1)
if len(itemList) == 1:
itemList[0].setSelected(True)
# make sure the item is found and selected after the update
itemList = self.list.findItems(scan, qt.Qt.MatchExactly,1)
if len(itemList) == 1:
itemList[0].setSelected(True)
if not self.lastScanWatcher.isActive():
self.lastScanWatcher.start()
else:
Expand Down Expand Up @@ -534,11 +511,10 @@ def __doubleClicked(self, item):
if updated:
self.data.refresh()
self.refresh()
if QTVERSION > "5.0.0":
# make sure the item is selected
itemList = self.list.findItems(sn, qt.Qt.MatchExactly,1)
if len(itemList) == 1:
itemList[0].setSelected(True)
# make sure the item is selected
itemList = self.list.findItems(sn, qt.Qt.MatchExactly,1)
if len(itemList) == 1:
itemList[0].setSelected(True)
#shortcut selec + remove?
#for the time being just add
self._addClicked()
Expand Down Expand Up @@ -586,8 +562,7 @@ def mcaDeviceSelected(self, ddict):

def __showScanInfo(self, idx = None):
if idx is None:
if QTVERSION > '4.0.0':
idx = self.menu_idx
idx = self.menu_idx
_logger.debug("Scan information:")

try:
Expand Down Expand Up @@ -624,11 +599,8 @@ def _addClicked(self, emit=True):
_logger.debug("Overwritten _addClicked method")

#get selected scan keys
if QTVERSION < '4.0.0':
scan_sel= [sn for sn in self.scans if self.list.findItem(sn,1).isSelected()]
else:
itemlist = self.list.selectedItems()
scan_sel = [str(item.text(1)) for item in itemlist]
itemlist = self.list.selectedItems()
scan_sel = [str(item.text(1)) for item in itemlist]

#get selected counter keys
cnt_sel = self.cntTable.getCounterSelection()
Expand Down
Loading