Skip to content

Commit

Permalink
Removed .ui files and made the UI setup "by hand". ui files cause mor…
Browse files Browse the repository at this point in the history
…e problems than they solve (UI designer is limited in what it can do).
  • Loading branch information
Virgil Dupras committed Oct 4, 2010
1 parent d574bc6 commit d2f968d
Show file tree
Hide file tree
Showing 37 changed files with 776 additions and 2,685 deletions.
2 changes: 0 additions & 2 deletions .hgignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ cocoa/*/Info.plist
cocoa/*/build
cocoa/*/dg_cocoa.plugin
qt/base/*_rc.py
qt/base/*_ui.py
qt/*/*_ui.py
qt/*/build
qt/*/dist
qt/*/install
Expand Down
3 changes: 0 additions & 3 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ def build_cocoa(edition, dev, help_destpath):

def build_qt(edition, dev):
print("Building Qt stuff")
build_all_qt_ui(op.join('qtlib', 'ui'))
build_all_qt_ui(op.join('qt', 'base'))
build_all_qt_ui(op.join('qt', edition))
print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))

def build_pe_modules(ui):
Expand Down
Empty file added qt/__init__.py
Empty file.
64 changes: 54 additions & 10 deletions qt/base/directories_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license

from PyQt4.QtCore import SIGNAL, Qt
from PyQt4.QtGui import QDialog, QFileDialog, QHeaderView
from PyQt4.QtCore import SIGNAL, Qt, QSize
from PyQt4.QtGui import (QDialog, QFileDialog, QHeaderView, QVBoxLayout, QHBoxLayout, QTreeView,
QAbstractItemView, QSpacerItem, QSizePolicy, QPushButton, QApplication)

from . import platform
from .directories_dialog_ui import Ui_DirectoriesDialog
from .directories_model import DirectoriesModel, DirectoriesDelegate

class DirectoriesDialog(QDialog, Ui_DirectoriesDialog):
class DirectoriesDialog(QDialog):
def __init__(self, parent, app):
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
QDialog.__init__(self, parent, flags)
self.app = app
self.lastAddedFolder = platform.INITIAL_FOLDER_IN_DIALOGS
self.directoriesModel = DirectoriesModel(self.app)
self.directoriesDelegate = DirectoriesDelegate()
self._setupUi()
self._updateRemoveButton()

Expand All @@ -29,19 +31,52 @@ def __init__(self, parent, app):
self.app.willSavePrefs.connect(self.appWillSavePrefs)

def _setupUi(self):
self.setupUi(self)
# Stuff that can't be done in the Designer
self.directoriesModel = DirectoriesModel(self.app)
self.directoriesDelegate = DirectoriesDelegate()
self.setWindowTitle("Directories")
self.resize(420, 338)
self.verticalLayout = QVBoxLayout(self)
self.treeView = QTreeView(self)
self.treeView.setItemDelegate(self.directoriesDelegate)
self.treeView.setModel(self.directoriesModel)

self.treeView.setAcceptDrops(True)
self.treeView.setEditTriggers(QAbstractItemView.DoubleClicked|QAbstractItemView.EditKeyPressed|QAbstractItemView.SelectedClicked)
self.treeView.setDragDropOverwriteMode(True)
self.treeView.setDragDropMode(QAbstractItemView.DropOnly)
self.treeView.setUniformRowHeights(True)
header = self.treeView.header()
header.setStretchLastSection(False)
header.setResizeMode(0, QHeaderView.Stretch)
header.setResizeMode(1, QHeaderView.Fixed)
header.resizeSection(1, 100)

self.verticalLayout.addWidget(self.treeView)
self.horizontalLayout = QHBoxLayout()
spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.removeButton = QPushButton(self)
self.removeButton.setText("Remove")
self.removeButton.setShortcut("Del")
self.removeButton.setMinimumSize(QSize(91, 0))
self.removeButton.setMaximumSize(QSize(16777215, 32))
self.horizontalLayout.addWidget(self.removeButton)
self.addButton = QPushButton(self)
self.addButton.setText("Add")
self.addButton.setMinimumSize(QSize(91, 0))
self.addButton.setMaximumSize(QSize(16777215, 32))
self.horizontalLayout.addWidget(self.addButton)
spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Fixed, QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem1)
self.doneButton = QPushButton(self)
self.doneButton.setText("Done")
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.doneButton.sizePolicy().hasHeightForWidth())
self.doneButton.setSizePolicy(sizePolicy)
self.doneButton.setMinimumSize(QSize(91, 0))
self.doneButton.setMaximumSize(QSize(16777215, 32))
self.doneButton.setDefault(True)
self.horizontalLayout.addWidget(self.doneButton)
self.verticalLayout.addLayout(self.horizontalLayout)

if self.app.prefs.directoriesWindowRect is not None:
self.setGeometry(self.app.prefs.directoriesWindowRect)

Expand Down Expand Up @@ -84,3 +119,12 @@ def removeButtonClicked(self):
def selectionChanged(self, selected, deselected):
self._updateRemoveButton()


if __name__ == '__main__':
import sys
from ..testapp import TestApp
app = QApplication([])
dgapp = TestApp()
dialog = DirectoriesDialog(None, dgapp)
dialog.show()
sys.exit(app.exec_())
145 changes: 0 additions & 145 deletions qt/base/directories_dialog.ui

This file was deleted.

Loading

0 comments on commit d2f968d

Please sign in to comment.