Fix file dialog and browser icons for lower resoluton displays.

main
Alex Huszagh 2022-05-01 01:18:31 -05:00
parent a694f3164c
commit 1bcde40657
5 changed files with 97 additions and 38 deletions

View File

@ -278,6 +278,89 @@ if sys.platform.lower().startswith('linux') and 'CONDA_PREFIX' in os.environ:
if args.use_x11:
os.environ['XDG_SESSION_TYPE'] = 'x11'
ICON_MAP = {
SP_TitleBarMinButton: 'minimize.svg',
SP_TitleBarMenuButton: 'menu.svg',
SP_TitleBarMaxButton: 'maximize.svg',
SP_TitleBarCloseButton: 'dialog_close.svg',
SP_TitleBarNormalButton: 'restore.svg',
SP_TitleBarShadeButton: 'shade.svg',
SP_TitleBarUnshadeButton: 'unshade.svg',
SP_TitleBarContextHelpButton: 'help.svg',
SP_MessageBoxInformation: 'message_information.svg',
SP_MessageBoxWarning: 'message_warning.svg',
SP_MessageBoxCritical: 'message_critical.svg',
SP_MessageBoxQuestion: 'message_question.svg',
SP_DesktopIcon: 'desktop.svg',
SP_TrashIcon: 'trash.svg',
SP_ComputerIcon: 'computer.svg',
SP_DriveFDIcon: 'floppy_drive.svg',
SP_DriveHDIcon: 'hard_drive.svg',
SP_DriveCDIcon: 'disc_drive.svg',
SP_DriveDVDIcon: 'disc_drive.svg',
SP_DriveNetIcon: 'network_drive.svg',
SP_DirHomeIcon: 'home_directory.svg',
SP_DirOpenIcon: 'folder_open.svg',
SP_DirClosedIcon: 'folder.svg',
SP_DirIcon: 'folder.svg',
SP_DirLinkIcon: 'folder_link.svg',
SP_DirLinkOpenIcon: 'folder_open_link.svg',
SP_FileIcon: 'file.svg',
SP_FileLinkIcon: 'file_link.svg',
SP_FileDialogStart: 'file_dialog_start.svg',
SP_FileDialogEnd: 'file_dialog_end.svg',
SP_FileDialogToParent: 'up_arrow.svg',
SP_FileDialogNewFolder: 'folder.svg',
SP_FileDialogDetailedView: 'file_dialog_detailed.svg',
SP_FileDialogInfoView: 'file_dialog_info.svg',
SP_FileDialogContentsView: 'file_dialog_contents.svg',
SP_FileDialogListView: 'file_dialog_list.svg',
SP_FileDialogBack: 'left_arrow.svg',
SP_DockWidgetCloseButton: 'close.svg',
SP_ToolBarHorizontalExtensionButton: 'horizontal_extension.svg',
SP_ToolBarVerticalExtensionButton: 'vertical_extension.svg',
SP_DialogOkButton: 'dialog_ok.svg',
SP_DialogCancelButton: 'dialog_cancel.svg',
SP_DialogHelpButton: 'dialog_help.svg',
SP_DialogOpenButton: 'dialog_open.svg',
SP_DialogSaveButton: 'dialog_save.svg',
SP_DialogCloseButton: 'dialog_close.svg',
SP_DialogApplyButton: 'dialog_apply.svg',
SP_DialogResetButton: 'dialog_reset.svg',
SP_DialogDiscardButton: 'dialog_discard.svg',
SP_DialogYesButton: 'dialog_apply.svg',
SP_DialogNoButton: 'dialog_no.svg',
SP_ArrowUp: 'up_arrow.svg',
SP_ArrowDown: 'down_arrow.svg',
SP_ArrowLeft: 'left_arrow.svg',
SP_ArrowRight: 'right_arrow.svg',
SP_ArrowBack: 'left_arrow.svg',
SP_ArrowForward: 'right_arrow.svg',
SP_CommandLink: 'right_arrow.svg',
SP_VistaShield: 'vista_shield.svg',
SP_BrowserReload: 'browser_refresh.svg',
SP_BrowserStop: 'browser_refresh_stop.svg',
SP_MediaPlay: 'play.svg',
SP_MediaStop: 'stop.svg',
SP_MediaPause: 'pause.svg',
SP_MediaSkipForward: 'skip_backward.svg',
SP_MediaSkipBackward: 'skip_forward.svg',
SP_MediaSeekForward: 'seek_forward.svg',
SP_MediaSeekBackward: 'seek_backward.svg',
SP_MediaVolume: 'volume.svg',
SP_MediaVolumeMuted: 'volume_muted.svg',
SP_LineEditClearButton: 'clear_text.svg',
SP_DialogYesToAllButton: 'dialog_yes_to_all.svg',
SP_DialogNoToAllButton: 'dialog_no.svg',
SP_DialogSaveAllButton: 'dialog_save_all.svg',
SP_DialogAbortButton: 'dialog_cancel.svg',
SP_DialogRetryButton: 'dialog_retry.svg',
SP_DialogIgnoreButton: 'dialog_ignore.svg',
SP_RestoreDefaultsButton: 'restore_defaults.svg',
}
if QtCore.QT_VERSION >= 393984:
ICON_MAP[SP_TabCloseButton] = 'tab_close.svg'
def standard_icon(widget, name):
'''Get the close icon depending on the stylesheet.'''
@ -298,34 +381,10 @@ def style_icon(style, icon, option=None, widget=None):
def stylesheet_icon(style, icon, option=None, widget=None):
'''Get a standard icon for the stylesheet style'''
if icon == SP_ArrowLeft:
return QtGui.QIcon(f'{resource_format}left_arrow.svg')
elif icon == SP_ArrowDown:
return QtGui.QIcon(f'{resource_format}down_arrow.svg')
elif icon == SP_ArrowRight:
return QtGui.QIcon(f'{resource_format}right_arrow.svg')
elif icon == SP_ArrowUp:
return QtGui.QIcon(f'{resource_format}up_arrow.svg')
elif icon == SP_DockWidgetCloseButton:
return QtGui.QIcon(f'{resource_format}close.svg')
elif icon == SP_DialogCancelButton:
return QtGui.QIcon(f'{resource_format}dialog_cancel.svg')
elif icon == SP_DialogCloseButton:
return QtGui.QIcon(f'{resource_format}dialog_close.svg')
elif icon == SP_DialogDiscardButton:
return QtGui.QIcon(f'{resource_format}dialog_discard.svg')
elif icon == SP_DialogHelpButton:
return QtGui.QIcon(f'{resource_format}dialog_help.svg')
elif icon == SP_DialogNoButton:
return QtGui.QIcon(f'{resource_format}dialog_no.svg')
elif icon == SP_DialogOkButton:
return QtGui.QIcon(f'{resource_format}dialog_ok.svg')
elif icon == SP_DialogOpenButton:
return QtGui.QIcon(f'{resource_format}dialog_open.svg')
elif icon == SP_DialogResetButton:
return QtGui.QIcon(f'{resource_format}dialog_reset.svg')
elif icon == SP_DialogSaveButton:
return QtGui.QIcon(f'{resource_format}dialog_save.svg')
path = ICON_MAP[icon]
resource = f'{resource_format}{path}'
if QtCore.QFile.exists(resource):
return QtGui.QIcon(resource)
return QtWidgets.QCommonStyle.standardIcon(style, icon, option, widget)

View File

@ -1,14 +1,14 @@
<svg width="109.5805" height="107.97688">
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:5;" d="M 190.31584,-39.807743 A 48.947918,48.947918 0 0 1 147.91853,8.6998659 48.947918,48.947918 0 0 1 94.173316,-26.824367" transform="rotate(65)" />
<path style="fill:none;stroke:^0^;stroke-width:8;" d="M 190.31584,-39.807743 A 48.947918,48.947918 0 0 1 147.91853,8.6998659 48.947918,48.947918 0 0 1 94.173316,-26.824367" transform="rotate(65)" />
</g>
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:5;" d="M -93.420002,39.597988 A 48.947918,48.947918 0 0 1 -135.81731,88.105597 48.947918,48.947918 0 0 1 -189.56252,52.581364" transform="rotate(-115)"/>
<path style="fill:none;stroke:^0^;stroke-width:8;" d="M -93.420002,39.597988 A 48.947918,48.947918 0 0 1 -135.81731,88.105597 48.947918,48.947918 0 0 1 -189.56252,52.581364" transform="rotate(-115)"/>
</g>
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:7.07107;" d="m 60.230721,74.289861 14.48156,14.996092"/>
<path style="fill:none;stroke:^0^;stroke-width:10;" d="m 60.230721,74.289861 14.48156,14.996092"/>
</g>
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:7.07107;" d="m 117.60187,132.95875 13.94939,15.49238"/>
<path style="fill:none;stroke:^0^;stroke-width:10;" d="m 117.60187,132.95875 13.94939,15.49238"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 894 B

View File

@ -1,11 +1,11 @@
<svg width="109.5805" height="107.97688">
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:5;" d="M 190.31584,-39.807743 A 48.947918,48.947918 0 0 1 147.91853,8.6998659 48.947918,48.947918 0 0 1 94.173316,-26.824367" transform="rotate(65)" />
<path style="fill:none;stroke:^0^;stroke-width:8;" d="M 190.31584,-39.807743 A 48.947918,48.947918 0 0 1 147.91853,8.6998659 48.947918,48.947918 0 0 1 94.173316,-26.824367" transform="rotate(65)" />
</g>
<g transform="translate(-39.823162,-58.532028)">
<path style="fill:none;stroke:^0^;stroke-width:5;" d="M -93.420002,39.597988 A 48.947918,48.947918 0 0 1 -135.81731,88.105597 48.947918,48.947918 0 0 1 -189.56252,52.581364" transform="rotate(-115)"/>
<path style="fill:none;stroke:^0^;stroke-width:8;" d="M -93.420002,39.597988 A 48.947918,48.947918 0 0 1 -135.81731,88.105597 48.947918,48.947918 0 0 1 -189.56252,52.581364" transform="rotate(-115)"/>
</g>
<g transform="translate(-39.823162,-58.532028)">
<rect style="fill:^0^;fill-opacity:1;stroke:none;stroke-width:3;" width="53.721176" height="13.630746" x="69.046471" y="104.97821"/>
<rect style="fill:^0^;fill-opacity:1;stroke:none;stroke-width:5;" width="53.721176" height="13.630746" x="69.046471" y="104.97821"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 768 B

After

Width:  |  Height:  |  Size: 768 B

View File

@ -2,6 +2,6 @@
<g transform="scale(0.9) translate(2, 2)">
<path fill="^0^" d="M6,2A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6M6,4H13V9H18V20H6V4M8,12V14H16V12H8M8,16V18H13V16H8Z"/>
</g>
<line x1="7" y1="10" x2="1" y2="13" stroke="^0^" stroke-width="1"/>
<circle cx="7" cy="10" r="3" stroke="^0^" fill="^1^" stroke-width="0.5"/>
<line x1="7" y1="10" x2="1" y2="13" stroke="^2^" stroke-width="2"/>
<circle cx="9" cy="10" r="5" stroke="^2^" fill="^1^" stroke-width="0.5"/>
</svg>

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

View File

@ -38,7 +38,7 @@
"default": ["foreground"]
},
"file_dialog_contents": {
"default": ["foreground", "highlight:alternate"]
"default": ["foreground", "highlight:alternate", "midtone"]
},
"file_dialog_detailed": {
"default": ["foreground", "midtone:light"]