Align query editing box with relation viewer

Not sure of what the problem was, probably some layout or frame that
had spacing.

Replaced the whole mess with a stacked widget instead.

close #8
master
Salvo 'LtWorf' Tomaselli 2015-11-20 17:06:59 +07:00
parent cd6bd42a2b
commit be8230d54a
2 changed files with 237 additions and 283 deletions

@ -87,9 +87,11 @@ class relForm(QtWidgets.QMainWindow):
def setMultiline(self, multiline): def setMultiline(self, multiline):
self.multiline = multiline self.multiline = multiline
self.settings.setValue('multiline', multiline) self.settings.setValue('multiline', multiline)
self.ui.lineExpressionFrame.setVisible(not multiline) if multiline:
self.ui.frmOptimizations.setVisible(not multiline) index = 0
self.ui.frmMultiLine.setVisible(multiline) else:
index = 1
self.ui.stackedWidget.setCurrentIndex(index)
self.ui.actionMulti_line_mode.setChecked(multiline) self.ui.actionMulti_line_mode.setChecked(multiline)
def load_query(self, *index): def load_query(self, *index):

@ -80,292 +80,255 @@
</property> </property>
</column> </column>
</widget> </widget>
<widget class="QWidget" name="layoutWidget"> <widget class="QStackedWidget" name="stackedWidget">
<layout class="QVBoxLayout" name="verticalLayout_6"> <property name="lineWidth">
<property name="sizeConstraint"> <number>0</number>
<enum>QLayout::SetMinimumSize</enum> </property>
</property> <property name="currentIndex">
<item> <number>0</number>
<widget class="QFrame" name="frmOptimizations"> </property>
<property name="frameShape"> <widget class="QWidget" name="multiline">
<enum>QFrame::NoFrame</enum> <layout class="QHBoxLayout" name="horizontalLayout">
</property> <property name="spacing">
<property name="frameShadow"> <number>0</number>
<enum>QFrame::Plain</enum> </property>
</property> <property name="leftMargin">
<property name="lineWidth"> <number>0</number>
<number>0</number> </property>
</property> <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPlainTextEdit" name="txtMultiQuery">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>60</height>
</size>
</property>
<property name="font">
<font>
<family>DejaVu Sans</family>
<pointsize>11</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
<kerning>true</kerning>
</font>
</property>
<property name="plainText">
<string/>
</property>
<property name="backgroundVisible">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>result=query</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QListWidget" name="lstHistory"> <widget class="QPushButton" name="cmdClearMultilineQuery">
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum"> <string>⌫</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <widget class="QPushButton" name="cmdExecuteMultiline">
<item> <property name="text">
<widget class="QPushButton" name="cmdOptimize"> <string>Execute</string>
<property name="text"> </property>
<string>Optimize</string> <property name="autoDefault">
</property> <bool>false</bool>
</widget> </property>
</item> <property name="default">
<item> <bool>true</bool>
<widget class="QPushButton" name="cmdUndoOptimize"> </property>
<property name="text"> </widget>
<string>Undo optimize</string> </item>
</property> <item>
</widget> <spacer name="verticalSpacer">
</item> <property name="orientation">
<item> <enum>Qt::Vertical</enum>
<widget class="QPushButton" name="cmdClearHistory"> </property>
<property name="text"> <property name="sizeHint" stdset="0">
<string>Clear history</string> <size>
</property> <width>20</width>
</widget> <height>40</height>
</item> </size>
</layout> </property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </item>
</item> </layout>
<item> </widget>
<widget class="QFrame" name="frmMultiLine"> <widget class="QWidget" name="single_line">
<property name="sizePolicy"> <layout class="QVBoxLayout" name="verticalLayout_4">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <property name="spacing">
<horstretch>0</horstretch> <number>2</number>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="leftMargin">
</property> <number>0</number>
<property name="frameShape"> </property>
<enum>QFrame::NoFrame</enum> <property name="topMargin">
</property> <number>0</number>
<property name="frameShadow"> </property>
<enum>QFrame::Plain</enum> <property name="rightMargin">
</property> <number>0</number>
<property name="lineWidth"> </property>
<number>0</number> <property name="bottomMargin">
</property> <number>0</number>
<layout class="QHBoxLayout" name="horizontalLayout_2"> </property>
<item>
<widget class="QListWidget" name="lstHistory">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>60</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QPushButton" name="cmdOptimize">
<property name="text">
<string>Optimize</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdUndoOptimize">
<property name="text">
<string>Undo optimize</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdClearHistory">
<property name="text">
<string>Clear history</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QPlainTextEdit" name="txtMultiQuery"> <widget class="QLineEdit" name="txtResult">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="text">
<size> <string>_last1</string>
<width>120</width>
<height>60</height>
</size>
</property>
<property name="font">
<font>
<family>DejaVu Sans</family>
<pointsize>11</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
<kerning>true</kerning>
</font>
</property>
<property name="plainText">
<string/>
</property>
<property name="backgroundVisible">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>result=query</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_4"> <widget class="QLabel" name="label">
<property name="spacing"> <property name="text">
<number>3</number> <string>=</string>
</property> </property>
<item> <property name="buddy">
<widget class="QPushButton" name="cmdClearMultilineQuery"> <cstring>txtQuery</cstring>
<property name="text"> </property>
<string>⌫</string> </widget>
</property> </item>
</widget> <item>
</item> <widget class="QLineEdit" name="txtQuery"/>
<item> </item>
<widget class="QPushButton" name="cmdExecuteMultiline"> <item>
<property name="text"> <widget class="QPushButton" name="cmdClearQuery">
<string>Execute</string> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<property name="autoDefault"> <horstretch>0</horstretch>
<bool>false</bool> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="default"> </property>
<bool>false</bool> <property name="maximumSize">
</property> <size>
</widget> <width>50</width>
</item> <height>16777215</height>
</layout> </size>
</property>
<property name="text">
<string>⌫</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdExecute">
<property name="text">
<string>Execute</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </item>
</item> </layout>
</layout> </widget>
</widget> </widget>
</widget> </widget>
</item> </item>
<item>
<widget class="QFrame" name="lineExpressionFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QLineEdit" name="txtResult">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>_last1</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>=</string>
</property>
<property name="buddy">
<cstring>txtQuery</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtQuery"/>
</item>
<item>
<widget class="QPushButton" name="cmdClearQuery">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>⌫</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cmdExecute">
<property name="text">
<string>Execute</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar"> <widget class="QMenuBar" name="menubar">
@ -373,8 +336,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>637</width> <width>644</width>
<height>18</height> <height>27</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -404,7 +367,7 @@
</widget> </widget>
<widget class="QMenu" name="menuSettings"> <widget class="QMenu" name="menuSettings">
<property name="title"> <property name="title">
<string>Settings</string> <string>Setti&amp;ngs</string>
</property> </property>
<addaction name="actionMulti_line_mode"/> <addaction name="actionMulti_line_mode"/>
</widget> </widget>
@ -421,7 +384,7 @@
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set> <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Operators</string> <string>&amp;Operators</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
@ -831,7 +794,7 @@
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set> <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Attributes</string> <string>Attrib&amp;utes</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>2</number> <number>2</number>
@ -892,7 +855,7 @@
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set> <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Relations</string> <string>Re&amp;lations</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>2</number> <number>2</number>
@ -998,7 +961,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>99</width> <width>99</width>
<height>89</height> <height>101</height>
</size> </size>
</property> </property>
<property name="features"> <property name="features">
@ -1008,7 +971,7 @@
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set> <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Menu</string> <string>&amp;Menu</string>
</property> </property>
<attribute name="dockWidgetArea"> <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
@ -1084,12 +1047,12 @@
</action> </action>
<action name="actionCheck_for_new_versions"> <action name="actionCheck_for_new_versions">
<property name="text"> <property name="text">
<string>Check for new versions</string> <string>&amp;Check for new versions</string>
</property> </property>
</action> </action>
<action name="actionNew_relation"> <action name="actionNew_relation">
<property name="text"> <property name="text">
<string>New relation</string> <string>&amp;New relation</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+N</string> <string>Ctrl+N</string>
@ -1097,7 +1060,7 @@
</action> </action>
<action name="actionEdit_relation"> <action name="actionEdit_relation">
<property name="text"> <property name="text">
<string>Edit relation</string> <string>&amp;Edit relation</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+E</string> <string>Ctrl+E</string>
@ -1123,7 +1086,7 @@
</action> </action>
<action name="actionUnload_relation"> <action name="actionUnload_relation">
<property name="text"> <property name="text">
<string>Unload relation</string> <string>&amp;Unload relation</string>
</property> </property>
</action> </action>
<action name="actionMulti_line_mode"> <action name="actionMulti_line_mode">
@ -1131,7 +1094,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Multi-line mode</string> <string>&amp;Multi-line mode</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+L</string> <string>Ctrl+L</string>
@ -1140,17 +1103,6 @@
</widget> </widget>
<tabstops> <tabstops>
<tabstop>table</tabstop> <tabstop>table</tabstop>
<tabstop>lstHistory</tabstop>
<tabstop>cmdOptimize</tabstop>
<tabstop>cmdUndoOptimize</tabstop>
<tabstop>cmdClearHistory</tabstop>
<tabstop>txtMultiQuery</tabstop>
<tabstop>cmdClearMultilineQuery</tabstop>
<tabstop>cmdExecuteMultiline</tabstop>
<tabstop>txtResult</tabstop>
<tabstop>txtQuery</tabstop>
<tabstop>cmdClearQuery</tabstop>
<tabstop>cmdExecute</tabstop>
<tabstop>cmdProduct</tabstop> <tabstop>cmdProduct</tabstop>
<tabstop>cmdDifference</tabstop> <tabstop>cmdDifference</tabstop>
<tabstop>cmdUnion</tabstop> <tabstop>cmdUnion</tabstop>