From 151358566aa7534ee3df50ac931d51a0c6cc2212 Mon Sep 17 00:00:00 2001 From: Jonathan Warren <git@jonwarren.org> Date: Fri, 21 Dec 2012 10:55:29 -0500 Subject: [PATCH] Windows resize to fit contents on different operating systems --- bitmessagemain.py | 4 +- help.py | 26 +++++++------ help.ui | 89 ++++++++++++++++++++++----------------------- newaddressdialog.py | 21 ++++++----- newaddressdialog.ui | 4 +- 5 files changed, 75 insertions(+), 69 deletions(-) diff --git a/bitmessagemain.py b/bitmessagemain.py index 8430139c..195e0114 100644 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -815,7 +815,7 @@ class receiveDataThread(QThread): if ackDataValidThusFar: print 'ackData is valid. Will process it.' #self.data = self.data[:self.payloadLength+24] + ackData + self.data[self.payloadLength+24:] - self.ackDataThatWeHaveYetToSend.append(ackData) #When we have processed all data + self.ackDataThatWeHaveYetToSend.append(ackData) #When we have processed all data, the processData function will pop the ackData out and process it as if it is a message received from our peer. #print 'self.data after:', repr(self.data) '''if ackData[4:16] == 'msg\x00\x00\x00\x00\x00\x00\x00\x00\x00': inventoryHash = calculateInventoryHash(ackData[24:]) @@ -2125,6 +2125,7 @@ class helpDialog(QtGui.QDialog): self.ui.setupUi(self) self.parent = parent self.ui.labelHelpURI.setOpenExternalLinks(True) + QtGui.QWidget.resize(self,QtGui.QWidget.sizeHint(self)) class aboutDialog(QtGui.QDialog): def __init__(self,parent): @@ -2226,6 +2227,7 @@ class NewAddressDialog(QtGui.QDialog): #print self.parent.ui.tableWidgetYourIdentities.item(row-1,1).text() self.ui.comboBoxExisting.addItem(self.parent.ui.tableWidgetYourIdentities.item(row-1,1).text()) row += 1 + #QtGui.QWidget.resize(self,QtGui.QWidget.sizeHint(self)) diff --git a/help.py b/help.py index f2267b5e..1124ff7d 100644 --- a/help.py +++ b/help.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'help.ui' # -# Created: Mon Nov 19 12:25:18 2012 +# Created: Wed Dec 19 15:53:53 2012 # by: PyQt4 UI code generator 4.9.4 # # WARNING! All changes made in this file will be lost! @@ -17,19 +17,23 @@ except AttributeError: class Ui_helpDialog(object): def setupUi(self, helpDialog): helpDialog.setObjectName(_fromUtf8("helpDialog")) - helpDialog.resize(335, 170) + helpDialog.resize(335, 96) + self.formLayout = QtGui.QFormLayout(helpDialog) + self.formLayout.setObjectName(_fromUtf8("formLayout")) + self.labelHelpURI = QtGui.QLabel(helpDialog) + self.labelHelpURI.setObjectName(_fromUtf8("labelHelpURI")) + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.labelHelpURI) + self.label = QtGui.QLabel(helpDialog) + self.label.setWordWrap(True) + self.label.setObjectName(_fromUtf8("label")) + self.formLayout.setWidget(0, QtGui.QFormLayout.SpanningRole, self.label) + spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.formLayout.setItem(2, QtGui.QFormLayout.LabelRole, spacerItem) self.buttonBox = QtGui.QDialogButtonBox(helpDialog) - self.buttonBox.setGeometry(QtCore.QRect(30, 120, 281, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) - self.label = QtGui.QLabel(helpDialog) - self.label.setGeometry(QtCore.QRect(30, 20, 291, 51)) - self.label.setWordWrap(True) - self.label.setObjectName(_fromUtf8("label")) - self.labelHelpURI = QtGui.QLabel(helpDialog) - self.labelHelpURI.setGeometry(QtCore.QRect(30, 70, 301, 21)) - self.labelHelpURI.setObjectName(_fromUtf8("labelHelpURI")) + self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.buttonBox) self.retranslateUi(helpDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), helpDialog.accept) @@ -38,6 +42,6 @@ class Ui_helpDialog(object): def retranslateUi(self, helpDialog): helpDialog.setWindowTitle(QtGui.QApplication.translate("helpDialog", "Help", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("helpDialog", "As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:", None, QtGui.QApplication.UnicodeUTF8)) self.labelHelpURI.setText(QtGui.QApplication.translate("helpDialog", "<a href=\"http://Bitmessage.org/wiki/PyBitmessage_Help\">http://Bitmessage.org/wiki/PyBitmessage_Help</a>", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("helpDialog", "As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/help.ui b/help.ui index f5062c20..e53e3ff9 100644 --- a/help.ui +++ b/help.ui @@ -7,57 +7,54 @@ <x>0</x> <y>0</y> <width>335</width> - <height>170</height> + <height>96</height> </rect> </property> <property name="windowTitle"> <string>Help</string> </property> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="geometry"> - <rect> - <x>30</x> - <y>120</y> - <width>281</width> - <height>32</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Ok</set> - </property> - </widget> - <widget class="QLabel" name="label"> - <property name="geometry"> - <rect> - <x>30</x> - <y>20</y> - <width>291</width> - <height>51</height> - </rect> - </property> - <property name="text"> - <string>As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - <widget class="QLabel" name="labelHelpURI"> - <property name="geometry"> - <rect> - <x>30</x> - <y>70</y> - <width>301</width> - <height>21</height> - </rect> - </property> - <property name="text"> - <string><a href="http://Bitmessage.org/wiki/PyBitmessage_Help">http://Bitmessage.org/wiki/PyBitmessage_Help</a></string> - </property> - </widget> + <layout class="QFormLayout" name="formLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="labelHelpURI"> + <property name="text"> + <string><a href="http://Bitmessage.org/wiki/PyBitmessage_Help">http://Bitmessage.org/wiki/PyBitmessage_Help</a></string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>As Bitmessage is a collaborative project, help can be found online in the Bitmessage Wiki:</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + </layout> </widget> <resources/> <connections> diff --git a/newaddressdialog.py b/newaddressdialog.py index beb48a48..053c83fa 100644 --- a/newaddressdialog.py +++ b/newaddressdialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'newaddressdialog.ui' # -# Created: Tue Sep 25 16:40:04 2012 +# Created: Wed Dec 19 15:55:07 2012 # by: PyQt4 UI code generator 4.9.4 # # WARNING! All changes made in this file will be lost! @@ -17,39 +17,42 @@ except AttributeError: class Ui_NewAddressDialog(object): def setupUi(self, NewAddressDialog): NewAddressDialog.setObjectName(_fromUtf8("NewAddressDialog")) - NewAddressDialog.resize(368, 257) + NewAddressDialog.resize(383, 258) self.buttonBox = QtGui.QDialogButtonBox(NewAddressDialog) self.buttonBox.setGeometry(QtCore.QRect(160, 220, 201, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.label = QtGui.QLabel(NewAddressDialog) - self.label.setGeometry(QtCore.QRect(10, 10, 351, 31)) + self.label.setGeometry(QtCore.QRect(10, 0, 361, 41)) + self.label.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) self.label.setWordWrap(True) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(NewAddressDialog) self.label_2.setGeometry(QtCore.QRect(20, 50, 301, 20)) self.label_2.setObjectName(_fromUtf8("label_2")) self.newaddresslabel = QtGui.QLineEdit(NewAddressDialog) - self.newaddresslabel.setGeometry(QtCore.QRect(20, 70, 341, 20)) + self.newaddresslabel.setGeometry(QtCore.QRect(20, 70, 351, 20)) self.newaddresslabel.setObjectName(_fromUtf8("newaddresslabel")) self.radioButtonMostAvailable = QtGui.QRadioButton(NewAddressDialog) self.radioButtonMostAvailable.setGeometry(QtCore.QRect(20, 110, 401, 16)) self.radioButtonMostAvailable.setChecked(True) self.radioButtonMostAvailable.setObjectName(_fromUtf8("radioButtonMostAvailable")) self.radioButtonExisting = QtGui.QRadioButton(NewAddressDialog) - self.radioButtonExisting.setGeometry(QtCore.QRect(20, 150, 271, 18)) + self.radioButtonExisting.setGeometry(QtCore.QRect(20, 150, 351, 18)) self.radioButtonExisting.setChecked(False) self.radioButtonExisting.setObjectName(_fromUtf8("radioButtonExisting")) self.label_3 = QtGui.QLabel(NewAddressDialog) - self.label_3.setGeometry(QtCore.QRect(33, 123, 331, 21)) + self.label_3.setGeometry(QtCore.QRect(35, 127, 351, 20)) + self.label_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(NewAddressDialog) - self.label_4.setGeometry(QtCore.QRect(37, 167, 341, 16)) + self.label_4.setGeometry(QtCore.QRect(37, 167, 351, 21)) + self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_4.setObjectName(_fromUtf8("label_4")) self.comboBoxExisting = QtGui.QComboBox(NewAddressDialog) self.comboBoxExisting.setEnabled(False) - self.comboBoxExisting.setGeometry(QtCore.QRect(40, 190, 321, 22)) + self.comboBoxExisting.setGeometry(QtCore.QRect(40, 190, 331, 22)) self.comboBoxExisting.setEditable(True) self.comboBoxExisting.setObjectName(_fromUtf8("comboBoxExisting")) @@ -61,7 +64,7 @@ class Ui_NewAddressDialog(object): def retranslateUi(self, NewAddressDialog): NewAddressDialog.setWindowTitle(QtGui.QApplication.translate("NewAddressDialog", "Create new Address", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("NewAddressDialog", "Here you may generate as many addresses as you like. Indeed, creating many addresses is encouraged.", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("NewAddressDialog", "Here you may generate as many addresses as you like. Indeed, creating and abandoning addresses is encouraged.", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("NewAddressDialog", "Label (not shown to anyone except you)", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonMostAvailable.setText(QtGui.QApplication.translate("NewAddressDialog", "Use the most available stream", None, QtGui.QApplication.UnicodeUTF8)) self.radioButtonExisting.setText(QtGui.QApplication.translate("NewAddressDialog", "Use the same stream as an existing address", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/newaddressdialog.ui b/newaddressdialog.ui index 40186c40..c53340ec 100644 --- a/newaddressdialog.ui +++ b/newaddressdialog.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>384</width> - <height>257</height> + <width>383</width> + <height>258</height> </rect> </property> <property name="windowTitle">