Skip to content

Commit

Permalink
update block button for see only icon in left
Browse files Browse the repository at this point in the history
update splitter size
  • Loading branch information
ibarbech committed Nov 20, 2018
1 parent 17097e5 commit c9461c5
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 15 deletions.
2 changes: 1 addition & 1 deletion learnbot_dsl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
import os, sys

path = os.path.dirname(os.path.realpath(__file__))
__version__ = '0.2.36'
__version__ = '0.2.39'
19 changes: 16 additions & 3 deletions learnbot_dsl/guis/Learnblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file '/home/ivan/robocomp/components/learnbot/learnbot_dsl/guis/Learnblock.ui'
#
# Created: Mon Nov 19 11:57:17 2018
# Created: Mon Nov 19 13:39:37 2018
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
Expand All @@ -23,15 +23,18 @@ def setupUi(self, MainWindow):
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.openpushButton = QtGui.QPushButton(self.centralwidget)
self.openpushButton.setText("")
self.openpushButton.setFlat(True)
self.openpushButton.setObjectName("openpushButton")
self.horizontalLayout_2.addWidget(self.openpushButton)
self.savepushButton = QtGui.QPushButton(self.centralwidget)
self.savepushButton.setText("")
self.savepushButton.setFlat(True)
self.savepushButton.setObjectName("savepushButton")
self.horizontalLayout_2.addWidget(self.savepushButton)
self.zoompushButton = QtGui.QPushButton(self.centralwidget)
self.zoompushButton.setText("")
self.zoompushButton.setCheckable(True)
self.zoompushButton.setFlat(True)
self.zoompushButton.setObjectName("zoompushButton")
self.horizontalLayout_2.addWidget(self.zoompushButton)
self.addNumberpushButton = QtGui.QPushButton(self.centralwidget)
Expand Down Expand Up @@ -181,12 +184,22 @@ def setupUi(self, MainWindow):
self.gridLayout = QtGui.QGridLayout(self.program_visual)
self.gridLayout.setObjectName("gridLayout")
self.splitter = QtGui.QSplitter(self.program_visual)
self.splitter.setMaximumSize(QtCore.QSize(16777215, 16777215))
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth())
self.splitter.setSizePolicy(sizePolicy)
self.splitter.setOrientation(QtCore.Qt.Horizontal)
self.splitter.setObjectName("splitter")
self.functions = QtGui.QTabWidget(self.splitter)
self.functions.setEnabled(True)
self.functions.setMaximumSize(QtCore.QSize(500, 16777215))
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.functions.sizePolicy().hasHeightForWidth())
self.functions.setSizePolicy(sizePolicy)
self.functions.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.functions.setBaseSize(QtCore.QSize(229, 0))
font = QtGui.QFont()
font.setPointSize(9)
font.setWeight(50)
Expand Down
42 changes: 36 additions & 6 deletions learnbot_dsl/guis/Learnblock.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<property name="text">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
Expand All @@ -41,6 +44,9 @@
<property name="text">
<string/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
Expand All @@ -54,6 +60,9 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -401,25 +410,46 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QSplitter" name="splitter">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="opaqueResize">
<bool>true</bool>
</property>
<property name="handleWidth">
<number>6</number>
</property>
<property name="childrenCollapsible">
<bool>true</bool>
</property>
<widget class="QTabWidget" name="functions">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>500</width>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>229</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
Expand Down
17 changes: 15 additions & 2 deletions learnbot_dsl/learnbotCode/Button.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, args):
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.updateImg)
self.timer.start(5)
self.setFlat(True)

def loadImg(self):
try:
Expand Down Expand Up @@ -79,10 +80,22 @@ def loadImg(self):
cv2.imwrite(self.tmpFile, img, (cv2.IMWRITE_PNG_COMPRESSION, 9))
else:
img = cv2.imread(self.tmpFile, cv2.IMREAD_UNCHANGED)
self.setIconSize(QtCore.QSize(135, img.shape[0]))
self.setFixedSize(QtCore.QSize(150, img.shape[0]))
width = self.__parent.ui.functions.width()-51
self.__table.setColumnWidth(0, width - 20)
self.setIconSize(QtCore.QSize(width - 20, img.shape[0]))
# self.setFixedSize(QtCore.QSize(150, img.shape[0]))
self.__table.setRowHeight(self.__row, img.shape[0])
self.setIcon(QtGui.QIcon(self.tmpFile))
self.setStyleSheet("QPushButton { text-align: left; }")
self.icon

def updateIconSize(self, width):
size = self.iconSize()
size.setWidth(width)
# print(self.__row)
# print(self.__table.row(self.__row))
size.setHeight(self.__table.rowHeight(self.__row))
self.setIconSize(size)

def updateToolTip(self):
try:
Expand Down
42 changes: 39 additions & 3 deletions learnbot_dsl/learnbotCode/LearnBlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ def __init__(self):
self.ui.zoompushButton.setIconSize(QtCore.QSize(30, 30))
self.ui.zoompushButton.setFixedSize(QtCore.QSize(30, 30))

self.disablestartButtons(False)
self.ui.functions.setFixedWidth(221)


self.disablestartButtons(False)
# self.ui.functions.setFixedWidth(221)
self.ui.splitter.splitterMoved.connect(self.resizeFunctionTab)
self.view = MyView(self, self.ui.frame)
self.view.setObjectName("view")
self.ui.verticalLayout_3.addWidget(self.view)
Expand Down Expand Up @@ -289,12 +291,46 @@ def __init__(self):
self.client = None
self.isOpen = True
self.savetmpProject()

new_sizes = self.ui.splitter.sizes()
size = sum(new_sizes)
self.ui.splitter.setSizes([233, size-233])
self.pre_sizes = self.ui.splitter.sizes()

# Execute the application
subprocess.Popen("aprilTag.py", shell=True, stdout=subprocess.PIPE)
subprocess.Popen("emotionrecognition2.py", shell=True, stdout=subprocess.PIPE)
r = self.app.exec_()

r = self.app.exec_()
sys.exit(r)

def resizeEvent(self, event):
QtGui.QMainWindow.resizeEvent(self, event)
new_sizes = self.ui.splitter.sizes()
size = sum(new_sizes)
self.pre_sizes[1] = size-self.pre_sizes[0]
self.ui.splitter.setSizes(self.pre_sizes)
self.resizeFunctionTab(None, None)

def resizeFunctionTab(self, pos, event):
# print(self.ui.splitter.sizes())
self.pre_sizes = self.ui.splitter.sizes()
width = self.ui.functions.width()-51
tables = [library.ui.tableLibrary for library in self.listLibraryWidget] + list(self.dicTables.values()) + [self.ui.tableSearch]
for v in tables:
v.setColumnWidth(0, width-20)
for item in [v.cellWidget(r, 0) for r in range(v.rowCount())]:
item.updateIconSize(width-20)
# for k, v in iter(self.dicTables.items()):
# v.setColumnWidth(0, width-20)
# for item in [v.cellWidget(r, 0) for r in range(v.rowCount())]:
# item.updateIconSize(width-20)
# for library in self.listLibraryWidget:
# v = library.ui.tableLibrary
# v.setColumnWidth(0, width - 20)
# for item in [v.cellWidget(r, 0) for r in range(v.rowCount())]:
# item.updateIconSize(width - 20)

def onClickedActionStart(self, simulated=False):
currenTab = self.ui.Tabwi.currentIndex()
if currenTab == 0:
Expand Down

0 comments on commit c9461c5

Please sign in to comment.