Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

OpenPype style in modules #1694

Merged
merged 9 commits into from
Jun 12, 2021
1 change: 1 addition & 0 deletions openpype/modules/clockify/clockify_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, api_key=None, master_parent=None):

self._secure_registry = None

@property
def secure_registry(self):
if self._secure_registry is None:
self._secure_registry = OpenPypeSecureRegistry("clockify")
Expand Down
115 changes: 48 additions & 67 deletions openpype/modules/clockify/widgets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from Qt import QtCore, QtGui, QtWidgets
from avalon import style
from openpype import resources
from openpype import resources, style


class MessageWidget(QtWidgets.QWidget):
Expand All @@ -22,14 +21,6 @@ def __init__(self, messages, title):
QtCore.Qt.WindowMinimizeButtonHint
)

# Font
self.font = QtGui.QFont()
self.font.setFamily("DejaVu Sans Condensed")
self.font.setPointSize(9)
self.font.setBold(True)
self.font.setWeight(50)
self.font.setKerning(True)

# Size setting
self.resize(self.SIZE_W, self.SIZE_H)
self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H))
Expand All @@ -53,7 +44,6 @@ def _ui_layout(self, messages):
labels = []
for message in messages:
label = QtWidgets.QLabel(message)
label.setFont(self.font)
label.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
label.setTextFormat(QtCore.Qt.RichText)
label.setWordWrap(True)
Expand Down Expand Up @@ -103,84 +93,64 @@ def __init__(self, clockapi, optional=True):
icon = QtGui.QIcon(resources.pype_icon_filepath())
self.setWindowIcon(icon)

self.setWindowTitle("Clockify settings")
self.setWindowFlags(
QtCore.Qt.WindowCloseButtonHint |
QtCore.Qt.WindowMinimizeButtonHint
)

self._translate = QtCore.QCoreApplication.translate

# Font
self.font = QtGui.QFont()
self.font.setFamily("DejaVu Sans Condensed")
self.font.setPointSize(9)
self.font.setBold(True)
self.font.setWeight(50)
self.font.setKerning(True)

# Size setting
self.resize(self.SIZE_W, self.SIZE_H)
self.setMinimumSize(QtCore.QSize(self.SIZE_W, self.SIZE_H))
self.setMaximumSize(QtCore.QSize(self.SIZE_W+100, self.SIZE_H+100))
self.setStyleSheet(style.load_stylesheet())

self.setLayout(self._main())
self.setWindowTitle('Clockify settings')

def _main(self):
self.main = QtWidgets.QVBoxLayout()
self.main.setObjectName("main")

self.form = QtWidgets.QFormLayout()
self.form.setContentsMargins(10, 15, 10, 5)
self.form.setObjectName("form")

self.label_api_key = QtWidgets.QLabel("Clockify API key:")
self.label_api_key.setFont(self.font)
self.label_api_key.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.label_api_key.setTextFormat(QtCore.Qt.RichText)
self.label_api_key.setObjectName("label_api_key")

self.input_api_key = QtWidgets.QLineEdit()
self.input_api_key.setEnabled(True)
self.input_api_key.setFrame(True)
self.input_api_key.setObjectName("input_api_key")
self.input_api_key.setPlaceholderText(
self._translate("main", "e.g. XX1XxXX2x3x4xXxx")
)
self._ui_init()

self.error_label = QtWidgets.QLabel("")
self.error_label.setFont(self.font)
self.error_label.setTextFormat(QtCore.Qt.RichText)
self.error_label.setObjectName("error_label")
self.error_label.setWordWrap(True)
self.error_label.hide()
def _ui_init(self):
label_api_key = QtWidgets.QLabel("Clockify API key:")

self.form.addRow(self.label_api_key, self.input_api_key)
self.form.addRow(self.error_label)
input_api_key = QtWidgets.QLineEdit()
input_api_key.setFrame(True)
input_api_key.setPlaceholderText("e.g. XX1XxXX2x3x4xXxx")

self.btn_group = QtWidgets.QHBoxLayout()
self.btn_group.addStretch(1)
self.btn_group.setObjectName("btn_group")
error_label = QtWidgets.QLabel("")
error_label.setTextFormat(QtCore.Qt.RichText)
error_label.setWordWrap(True)
error_label.hide()

self.btn_ok = QtWidgets.QPushButton("Ok")
self.btn_ok.setToolTip('Sets Clockify API Key so can Start/Stop timer')
self.btn_ok.clicked.connect(self.click_ok)
form_layout = QtWidgets.QFormLayout()
form_layout.setContentsMargins(10, 15, 10, 5)
form_layout.addRow(label_api_key, input_api_key)
form_layout.addRow(error_label)

self.btn_cancel = QtWidgets.QPushButton("Cancel")
btn_ok = QtWidgets.QPushButton("Ok")
btn_ok.setToolTip('Sets Clockify API Key so can Start/Stop timer')

btn_cancel = QtWidgets.QPushButton("Cancel")
cancel_tooltip = 'Application won\'t start'
if self.optional:
cancel_tooltip = 'Close this window'
self.btn_cancel.setToolTip(cancel_tooltip)
self.btn_cancel.clicked.connect(self._close_widget)
btn_cancel.setToolTip(cancel_tooltip)

btn_group = QtWidgets.QHBoxLayout()
btn_group.addStretch(1)
btn_group.addWidget(btn_ok)
btn_group.addWidget(btn_cancel)

main_layout = QtWidgets.QVBoxLayout(self)
main_layout.addLayout(form_layout)
main_layout.addLayout(btn_group)

self.btn_group.addWidget(self.btn_ok)
self.btn_group.addWidget(self.btn_cancel)
btn_ok.clicked.connect(self.click_ok)
btn_cancel.clicked.connect(self._close_widget)

self.main.addLayout(self.form)
self.main.addLayout(self.btn_group)
self.label_api_key = label_api_key
self.input_api_key = input_api_key
self.error_label = error_label

return self.main
self.btn_ok = btn_ok
self.btn_cancel = btn_cancel

def setError(self, msg):
self.error_label.setText(msg)
Expand Down Expand Up @@ -212,6 +182,17 @@ def click_ok(self):
"Entered invalid API key"
)

def showEvent(self, event):
super(ClockifySettings, self).showEvent(event)

# Make btns same width
max_width = max(
self.btn_ok.sizeHint().width(),
self.btn_cancel.sizeHint().width()
)
self.btn_ok.setMinimumWidth(max_width)
self.btn_cancel.setMinimumWidth(max_width)

def closeEvent(self, event):
if self.optional is True:
event.ignore()
Expand Down
9 changes: 6 additions & 3 deletions openpype/modules/ftrack/tray/login_dialog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import requests
from avalon import style
from openpype import style
from openpype.modules.ftrack.lib import credentials
from . import login_tools
from openpype import resources
Expand Down Expand Up @@ -46,8 +46,11 @@ def ui_init(self):
self.user_label = QtWidgets.QLabel("Username:")
self.api_label = QtWidgets.QLabel("API Key:")

self.ftsite_input = QtWidgets.QLineEdit()
self.ftsite_input.setReadOnly(True)
self.ftsite_input = QtWidgets.QLabel()
self.ftsite_input.setTextInteractionFlags(
QtCore.Qt.TextBrowserInteraction
)
# self.ftsite_input.setReadOnly(True)
self.ftsite_input.setCursor(QtGui.QCursor(QtCore.Qt.IBeamCursor))

self.user_input = QtWidgets.QLineEdit()
Expand Down
17 changes: 13 additions & 4 deletions openpype/modules/muster/widget_login.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import os
from Qt import QtCore, QtGui, QtWidgets
from avalon import style
from openpype import resources
from openpype import resources, style


class MusterLogin(QtWidgets.QWidget):

SIZE_W = 300
SIZE_H = 130
SIZE_H = 150

loginSignal = QtCore.Signal(object, object, object)

Expand Down Expand Up @@ -123,7 +122,6 @@ def keyPressEvent(self, key_event):
super().keyPressEvent(key_event)

def setError(self, msg):

self.error_label.setText(msg)
self.error_label.show()

Expand All @@ -149,6 +147,17 @@ def click_ok(self):
def save_credentials(self, username, password):
self.module.get_auth_token(username, password)

def showEvent(self, event):
super(MusterLogin, self).showEvent(event)

# Make btns same width
max_width = max(
self.btn_ok.sizeHint().width(),
self.btn_cancel.sizeHint().width()
)
self.btn_ok.setMinimumWidth(max_width)
self.btn_cancel.setMinimumWidth(max_width)

def closeEvent(self, event):
event.ignore()
self._close_widget()
Expand Down
3 changes: 1 addition & 2 deletions openpype/modules/timers_manager/widget_user_idle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from avalon import style
from Qt import QtCore, QtGui, QtWidgets
from openpype import resources
from openpype import resources, style


class WidgetUserIdle(QtWidgets.QWidget):
Expand Down