Skip to content

Commit

Permalink
Merge pull request #43 from PASTA-ELN/guiImprovements
Browse files Browse the repository at this point in the history
change button text-color; tab in textEdit for form
  • Loading branch information
SteffenBrinckmann authored Sep 18, 2023
2 parents 55d4d8b + 5148ae5 commit 0d88b1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
1 change: 1 addition & 0 deletions pasta_eln/GUI/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,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

0 comments on commit 0d88b1d

Please sign in to comment.