qtvcp -make the softkey optional on widgets
This commit is contained in:
parent
fbd3f7f261
commit
36820175f1
7 changed files with 33 additions and 11 deletions
|
|
@ -1077,13 +1077,14 @@ class EntryDialog(QDialog, _HalWidgetBase):
|
|||
l = QVBoxLayout()
|
||||
self.setLayout(l)
|
||||
|
||||
o = TouchInputWidget()
|
||||
l.addWidget(o)
|
||||
self.softkey = TouchInputWidget(self)
|
||||
l.addWidget(self.softkey)
|
||||
|
||||
self.Num = QLineEdit()
|
||||
# actiate touch input
|
||||
self.Num.keyboard_type = 'numeric'
|
||||
self.Num.returnPressed.connect(lambda: self.accept())
|
||||
self.Num.keyboard_type = 'numeric'
|
||||
self.Num.keyboard_enable = True
|
||||
|
||||
gl = QVBoxLayout()
|
||||
gl.addWidget(self.Num)
|
||||
|
|
@ -1095,7 +1096,7 @@ class EntryDialog(QDialog, _HalWidgetBase):
|
|||
self.bBox.accepted.connect(self.accept)
|
||||
|
||||
gl.addWidget(self.bBox)
|
||||
o.setLayout(gl)
|
||||
self.softkey.setLayout(gl)
|
||||
|
||||
def _hal_init(self):
|
||||
x = self.geometry().x()
|
||||
|
|
@ -1165,8 +1166,17 @@ class EntryDialog(QDialog, _HalWidgetBase):
|
|||
def resetIdName(self):
|
||||
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)
|
||||
overlay_color = pyqtProperty(QColor, getColor, setColor)
|
||||
soft_keyboard_option = pyqtProperty(bool, get_soft_keyboard, set_soft_keyboard, reset_soft_keyboard)
|
||||
|
||||
############################################
|
||||
# Calculator Dialog
|
||||
|
|
|
|||
|
|
@ -280,7 +280,6 @@ min-width: 30px;
|
|||
def get_vline(self):
|
||||
return self._get_line()
|
||||
|
||||
|
||||
class TouchInterface(QtCore.QObject):
|
||||
def __init__(self, PARENT_WIDGET):
|
||||
super(TouchInterface, self).__init__()
|
||||
|
|
@ -298,6 +297,8 @@ class TouchInterface(QtCore.QObject):
|
|||
try:
|
||||
if self._PARENT_WIDGET.focusWidget() == widget and event.type() == QtCore.QEvent.MouseButtonPress:
|
||||
if hasattr(widget, 'keyboard_type'):
|
||||
if hasattr(widget, 'keyboard_enable') and widget.keyboard_enable is False:
|
||||
return False
|
||||
if widget.keyboard_type.lower() == 'alpha':
|
||||
self._input_panel_alpha.show_input_panel(widget)
|
||||
elif widget.keyboard_type.lower() == 'numeric':
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ from PyQt5.QtGui import QStandardItemModel, QStandardItem
|
|||
from qtvcp.widgets.widget_baseclass import _HalWidgetBase
|
||||
from qtvcp.widgets.mdi_line import MDILine
|
||||
from qtvcp.core import Status, Action, Info
|
||||
from qtvcp.widgets.entry_widget import SoftInputWidget
|
||||
from qtvcp import logger
|
||||
|
||||
# Instiniate the libraries with global reference
|
||||
|
|
|
|||
|
|
@ -113,10 +113,10 @@ class MDILine(MDI):
|
|||
if self.focusWidget() == widget and event.type() == QEvent.MouseButtonPress:
|
||||
if self.soft_keyboard:
|
||||
self._input_panel_full.show_input_panel(widget)
|
||||
try:
|
||||
ACTION.SET_MDI_MODE()
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
ACTION.SET_MDI_MODE()
|
||||
except:
|
||||
pass
|
||||
return False
|
||||
|
||||
#########################################################################
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
|
|||
self._close_color = QtGui.QColor(100, 0, 0, 150)
|
||||
self._messageDialogColor = 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._toolDialogColor = QtGui.QColor(100, 0, 0, 150)
|
||||
self._fileDialogColor = QtGui.QColor(0, 0, 100, 150)
|
||||
|
|
@ -353,6 +354,7 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
|
|||
w.entryDialog_ = EntryDialog()
|
||||
w.entryDialog_.hal_init(self.HAL_GCOMP_, self.HAL_NAME_,
|
||||
w.entryDialog_, w, w.PATHS, self.PREFS_)
|
||||
w.entryDialog_.soft_keyboard_option = self._entryDialogSoftkey
|
||||
w.entryDialog_.overlay_color = self._entryDialogColor
|
||||
|
||||
def init_file_dialog(self):
|
||||
|
|
@ -547,6 +549,13 @@ class ScreenOptions(QtWidgets.QWidget, _HalWidgetBase):
|
|||
def reset_entryDialog(self):
|
||||
self.add_entry_dialog = False
|
||||
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):
|
||||
return self._entryDialogColor
|
||||
def set_entryDialogColor(self, value):
|
||||
|
|
|
|||
|
|
@ -1901,7 +1901,7 @@ file</string>
|
|||
<string>Step</string>
|
||||
</property>
|
||||
<property name="estop_action" stdset="0">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="run_action" stdset="0">
|
||||
<bool>false</bool>
|
||||
|
|
|
|||
|
|
@ -936,6 +936,9 @@
|
|||
<property name="entryDialog_option" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="entryDialogSoftkey_option" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolDialog_option" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
|
|
|||
Loading…
Reference in a new issue