Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change button text-color; tab in textEdit for form #43

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions pasta_eln/GUI/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def __init__(self, comm:Communicate, doc:dict[str,Any]):
rightSideL.addWidget(getattr(self, f'buttonBarW_{key}'))
setattr(self, f'textEdit_{key}', QPlainTextEdit(value))
getattr(self, f'textEdit_{key}').setAccessibleName(key)
getattr(self, f'textEdit_{key}').setTabStopDistance(20)
getattr(self, f'textEdit_{key}').textChanged.connect(self.textChanged)
setattr(self, f'textShow_{key}', QTextEdit(value))
getattr(self, f'textShow_{key}').setReadOnly(True)
Expand Down
18 changes: 7 additions & 11 deletions pasta_eln/guiStyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
def getColor(backend:Backend, color:str) -> str:
"""
get color from theme
- Python access: theme = get_theme(themeName)
- For dark-blue:
- {'primaryColor': '#448aff', 'primaryLightColor': '#83b9ff', 'secondaryColor': '#232629', 'secondaryLightColor': '#4f5b62',
- 'secondaryDarkColor': '#31363b', 'primaryTextColor': '#000000', 'secondaryTextColor': '#ffffff'}

Args:
backend (Pasta): backend instance
Expand All @@ -32,17 +36,9 @@ def getColor(backend:Backend, color:str) -> str:
Returns:
str: #123456 color code
"""
if hasattr(backend, 'configuration'):
themeName = backend.configuration['GUI']['theme']
else:
themeName = 'none'
# theme = get_theme(themeName)
# print(theme)
## For dark-blue:
## {'primaryColor': '#448aff', 'primaryLightColor': '#83b9ff', 'secondaryColor': '#232629', 'secondaryLightColor': '#4f5b62',
## 'secondaryDarkColor': '#31363b', 'primaryTextColor': '#000000', 'secondaryTextColor': '#ffffff'}
if themeName == 'none':
if not hasattr(backend, 'configuration') or backend.configuration['GUI']['theme']=='none':
return '#000000'
themeName = backend.configuration['GUI']['theme']
return get_theme(f'{themeName}.xml')[f'{color}Color']


Expand Down Expand Up @@ -72,7 +68,7 @@ def __init__(self, label:str, widget:QWidget, command:list[Any]=[], layout:Optio
self.setStyleSheet(style)
else:
primaryColor = getColor(widget.comm.backend, 'primary')
secTextColor = getColor(widget.comm.backend, 'secondaryText')
secTextColor = getColor(widget.comm.backend, 'secondary')
self.setStyleSheet(f'border-width: 0px; background-color: {primaryColor}; color: {secTextColor}')
if hide:
self.hide()
Expand Down