Skip to content
Prev Previous commit
Next Next commit
Improved location QLineEdit
  • Loading branch information
jeylau committed Jun 16, 2023
commit 147a2b5e320c836d0e5908fcaec6e544bf0b75a9
8 changes: 8 additions & 0 deletions deeplabcut/gui/tabs/create_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@

import deeplabcut
from deeplabcut.utils import auxiliaryfunctions
from deeplabcut.gui import BASE_DIR
from deeplabcut.gui.dlc_params import DLCParams
from deeplabcut.gui.widgets import ClickableLabel, ItemSelectionFrame

from PySide6 import QtCore, QtWidgets
from PySide6.QtGui import QIcon


class ProjectCreator(QtWidgets.QDialog):
Expand Down Expand Up @@ -60,6 +62,12 @@ def lay_out_user_frame(self):
loc_label = ClickableLabel("Location:", parent=user_frame)
loc_label.signal.connect(self.on_click)
self.loc_line = QtWidgets.QLineEdit(self.loc_default, user_frame)
self.loc_line.setReadOnly(True)
action = self.loc_line.addAction(
QIcon(os.path.join(BASE_DIR, "assets", "icons", "open2.png")),
self.loc_line.TrailingPosition,
)
action.triggered.connect(self.on_click)

vbox = QtWidgets.QVBoxLayout(user_frame)
grid = QtWidgets.QGridLayout()
Expand Down
3 changes: 2 additions & 1 deletion deeplabcut/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ class ClickableLabel(QtWidgets.QLabel):

def __init__(self, text="", color="turquoise", parent=None):
super(ClickableLabel, self).__init__(text, parent)
self.color = color
self._default_style = self.styleSheet()
self.color = color
self.setStyleSheet(f"color: {self.color}")

def mouseReleaseEvent(self, event):
self.signal.emit()
Expand Down