qtvcp -make the softkey optional on widgets

This commit is contained in:
Chris Morley 2019-09-08 01:35:11 -07:00
parent fbd3f7f261
commit 36820175f1
7 changed files with 33 additions and 11 deletions

View file

@ -1077,13 +1077,14 @@ class EntryDialog(QDialog, _HalWidgetBase):
l = QVBoxLayout() l = QVBoxLayout()
self.setLayout(l) self.setLayout(l)
o = TouchInputWidget() self.softkey = TouchInputWidget(self)
l.addWidget(o) l.addWidget(self.softkey)
self.Num = QLineEdit() self.Num = QLineEdit()
# actiate touch input # actiate touch input
self.Num.keyboard_type = 'numeric'
self.Num.returnPressed.connect(lambda: self.accept()) self.Num.returnPressed.connect(lambda: self.accept())
self.Num.keyboard_type = 'numeric'
self.Num.keyboard_enable = True
gl = QVBoxLayout() gl = QVBoxLayout()
gl.addWidget(self.Num) gl.addWidget(self.Num)
@ -1095,7 +1096,7 @@ class EntryDialog(QDialog, _HalWidgetBase):
self.bBox.accepted.connect(self.accept) self.bBox.accepted.connect(self.accept)
gl.addWidget(self.bBox) gl.addWidget(self.bBox)
o.setLayout(gl) self.softkey.setLayout(gl)
def _hal_init(self): def _hal_init(self):
x = self.geometry().x() x = self.geometry().x()
@ -1165,8 +1166,17 @@ class EntryDialog(QDialog, _HalWidgetBase):
def resetIdName(self): def resetIdName(self):
self._request_name = 'ENTRY' self._request_name = 'ENTRY'
def set_soft_keyboard(self, data):
self.Num.keyboard_enable = data
def get_soft_keyboard(self):
return self.Num.keyboard_enable
def reset_soft_keyboard(self):
self.Num.keyboard_enable = True
# designer will show these properties in this order:
launch_id = pyqtProperty(str, getIdName, setIdName, resetIdName) launch_id = pyqtProperty(str, getIdName, setIdName, resetIdName)
overlay_color = pyqtProperty(QColor, getColor, setColor) overlay_color = pyqtProperty(QColor, getColor, setColor)
soft_keyboard_option = pyqtProperty(bool, get_soft_keyboard, set_soft_keyboard, reset_soft_keyboard)
############################################ ############################################
# Calculator Dialog # Calculator Dialog

View file

@ -280,7 +280,6 @@ min-width: 30px;
def get_vline(self): def get_vline(self):
return self._get_line() return self._get_line()
class TouchInterface(QtCore.QObject): class TouchInterface(QtCore.QObject):
def __init__(self, PARENT_WIDGET): def __init__(self, PARENT_WIDGET):
super(TouchInterface, self).__init__() super(TouchInterface, self).__init__()
@ -298,6 +297,8 @@ class TouchInterface(QtCore.QObject):
try: try:
if self._PARENT_WIDGET.focusWidget() == widget and event.type() == QtCore.QEvent.MouseButtonPress: if self._PARENT_WIDGET.focusWidget() == widget and event.type() == QtCore.QEvent.MouseButtonPress:
if hasattr(widget, 'keyboard_type'): if hasattr(widget, 'keyboard_type'):
if hasattr(widget, 'keyboard_enable') and widget.keyboard_enable is False:
return False
if widget.keyboard_type.lower() == 'alpha': if widget.keyboard_type.lower() == 'alpha':
self._input_panel_alpha.show_input_panel(widget) self._input_panel_alpha.show_input_panel(widget)
elif widget.keyboard_type.lower() == 'numeric': elif widget.keyboard_type.lower() == 'numeric':

View file

@ -22,7 +22,6 @@ from PyQt5.QtGui import QStandardItemModel, QStandardItem
from qtvcp.widgets.widget_baseclass import _HalWidgetBase from qtvcp.widgets.widget_baseclass import _HalWidgetBase
from qtvcp.widgets.mdi_line import MDILine from qtvcp.widgets.mdi_line import MDILine
from qtvcp.core import Status, Action, Info from qtvcp.core import Status, Action, Info
from qtvcp.widgets.entry_widget import SoftInputWidget
from qtvcp import logger from qtvcp import logger
# Instiniate the libraries with global reference # Instiniate the libraries with global reference

View file

@ -93,6 +93,7 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
self._close_color = QtGui.QColor(100, 0, 0, 150) self._close_color = QtGui.QColor(100, 0, 0, 150)
self._messageDialogColor = QtGui.QColor(0, 0, 0, 150) self._messageDialogColor = QtGui.QColor(0, 0, 0, 150)
self._closeDialogColor = QtGui.QColor(0, 0, 0, 150) self._closeDialogColor = QtGui.QColor(0, 0, 0, 150)
self._entryDialogSoftkey = True
self._entryDialogColor = QtGui.QColor(0, 0, 0, 150) self._entryDialogColor = QtGui.QColor(0, 0, 0, 150)
self._toolDialogColor = QtGui.QColor(100, 0, 0, 150) self._toolDialogColor = QtGui.QColor(100, 0, 0, 150)
self._fileDialogColor = QtGui.QColor(0, 0, 100, 150) self._fileDialogColor = QtGui.QColor(0, 0, 100, 150)
@ -353,6 +354,7 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
w.entryDialog_ = EntryDialog() w.entryDialog_ = EntryDialog()
w.entryDialog_.hal_init(self.HAL_GCOMP_, self.HAL_NAME_, w.entryDialog_.hal_init(self.HAL_GCOMP_, self.HAL_NAME_,
w.entryDialog_, w, w.PATHS, self.PREFS_) w.entryDialog_, w, w.PATHS, self.PREFS_)
w.entryDialog_.soft_keyboard_option = self._entryDialogSoftkey
w.entryDialog_.overlay_color = self._entryDialogColor w.entryDialog_.overlay_color = self._entryDialogColor
def init_file_dialog(self): def init_file_dialog(self):
@ -547,6 +549,13 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
def reset_entryDialog(self): def reset_entryDialog(self):
self.add_entry_dialog = False self.add_entry_dialog = False
entryDialog_option = QtCore.pyqtProperty(bool, get_entryDialog, set_entryDialog, reset_entryDialog) entryDialog_option = QtCore.pyqtProperty(bool, get_entryDialog, set_entryDialog, reset_entryDialog)
def set_entryDialogSoftkey(self, data):
self._entryDialogSoftkey = data
def get_entryDialogSoftkey(self):
return self._entryDialogSoftkey
def reset_entryDialogSoftkey(self):
self._entryDialogSoftkey = False
entryDialogSoftkey_option = QtCore.pyqtProperty(bool, get_entryDialogSoftkey, set_entryDialogSoftkey, reset_entryDialogSoftkey)
def get_entryDialogColor(self): def get_entryDialogColor(self):
return self._entryDialogColor return self._entryDialogColor
def set_entryDialogColor(self, value): def set_entryDialogColor(self, value):

View file

@ -1901,7 +1901,7 @@ file</string>
<string>Step</string> <string>Step</string>
</property> </property>
<property name="estop_action" stdset="0"> <property name="estop_action" stdset="0">
<bool>true</bool> <bool>false</bool>
</property> </property>
<property name="run_action" stdset="0"> <property name="run_action" stdset="0">
<bool>false</bool> <bool>false</bool>

View file

@ -936,6 +936,9 @@
<property name="entryDialog_option" stdset="0"> <property name="entryDialog_option" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="entryDialogSoftkey_option" stdset="0">
<bool>false</bool>
</property>
<property name="toolDialog_option" stdset="0"> <property name="toolDialog_option" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>