def __init__(self, errorReporter): super(QCalcHistory, self).__init__() self._prettyRenderer = operation.render_number() self._errorLog = errorReporter self._historyStore = QtGui.QStandardItemModel() self._historyStore.setHorizontalHeaderLabels(["", "Equation", "Result"]) self._historyStore.itemChanged.connect(self._on_item_changed) self._historyView = QtGui.QTreeView() self._historyView.setModel(self._historyStore) self._historyView.setUniformRowHeights(True) self._historyView.setRootIsDecorated(False) self._historyView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self._historyView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self._historyView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self._historyView.setHeaderHidden(True) self._historyView.activated.connect(self._on_row_activated) viewHeader = self._historyView.header() viewHeader.setSortIndicatorShown(True) viewHeader.setClickable(True) viewHeader.setResizeMode(self._CLOSE_COLUMN, QtGui.QHeaderView.ResizeToContents) viewHeader.setResizeMode(self._EQ_COLUMN, QtGui.QHeaderView.Stretch) viewHeader.setResizeMode(self._RESULT_COLUMN, QtGui.QHeaderView.ResizeToContents) viewHeader.setStretchLastSection(False) self._rowCount = 0 self._programmaticUpdate = False self._closeIcon = qui_utils.get_theme_icon(("window-close", "general_close", "gtk-close"))
def __init__(self, app, session): self._app = app self._session = session self._targetLayout = QtGui.QVBoxLayout() self._targetList = QtGui.QWidget() self._targetList.setLayout(self._targetLayout) self._uiItems = [] self._closeIcon = qui_utils.get_theme_icon(("window-close", "general_close", "gtk-close"), self._SENTINEL_ICON)
def __init__(self, app, session, errorLog): self._app = app self._session = session self._session.accountUpdated.connect(self._on_contacts_updated) self._errorLog = errorLog self._addressBookFactories = [ null_backend.NullAddressBookFactory(), file_backend.FilesystemAddressBookFactory(app.fsContactsPath), qt_backend.QtContactsAddressBookFactory(), ] self._addressBooks = [] self._listSelection = QtGui.QComboBox() self._listSelection.addItems([]) self._listSelection.currentIndexChanged[str].connect(self._on_filter_changed) self._activeList = "None" refreshIcon = qui_utils.get_theme_icon( ("view-refresh", "general_refresh", "gtk-refresh", ), _SENTINEL_ICON ) if refreshIcon is not _SENTINEL_ICON: self._refreshButton = QtGui.QPushButton(refreshIcon, "") else: self._refreshButton = QtGui.QPushButton("Refresh") self._refreshButton.clicked.connect(self._on_refresh_clicked) self._refreshButton.setSizePolicy(QtGui.QSizePolicy( QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.PushButton, )) self._managerLayout = QtGui.QHBoxLayout() self._managerLayout.addWidget(self._listSelection, 1000) self._managerLayout.addWidget(self._refreshButton, 0) self._itemStore = QtGui.QStandardItemModel() self._itemStore.setHorizontalHeaderLabels(["Contacts"]) self._alphaItem = {} self._itemView = QtGui.QTreeView() self._itemView.setModel(self._itemStore) self._itemView.setUniformRowHeights(True) self._itemView.setRootIsDecorated(False) self._itemView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self._itemView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self._itemView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self._itemView.setHeaderHidden(True) self._itemView.setItemsExpandable(False) self._itemView.activated.connect(self._on_row_activated) self._layout = QtGui.QVBoxLayout() self._layout.addLayout(self._managerLayout) self._layout.addWidget(self._itemView) self._widget = QtGui.QWidget() self._widget.setLayout(self._layout) self.update_addressbooks() self._populate_items()
def __init__(self, app, session, errorLog): self._selectedTypeFilter = self.ALL_TYPES self._selectedStatusFilter = self.ALL_STATUS self._app = app self._session = session self._session.messagesUpdated.connect(self._on_messages_updated) self._errorLog = errorLog self._typeSelection = QtGui.QComboBox() self._typeSelection.addItems(self.MESSAGE_TYPES) self._typeSelection.setCurrentIndex( self.MESSAGE_TYPES.index(self._selectedTypeFilter) ) self._typeSelection.currentIndexChanged[str].connect(self._on_type_filter_changed) self._statusSelection = QtGui.QComboBox() self._statusSelection.addItems(self.MESSAGE_STATUSES) self._statusSelection.setCurrentIndex( self.MESSAGE_STATUSES.index(self._selectedStatusFilter) ) self._statusSelection.currentIndexChanged[str].connect(self._on_status_filter_changed) refreshIcon = qui_utils.get_theme_icon( ("view-refresh", "general_refresh", "gtk-refresh", ), _SENTINEL_ICON ) if refreshIcon is not _SENTINEL_ICON: self._refreshButton = QtGui.QPushButton(refreshIcon, "") else: self._refreshButton = QtGui.QPushButton("Refresh") self._refreshButton.clicked.connect(self._on_refresh_clicked) self._refreshButton.setSizePolicy(QtGui.QSizePolicy( QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.PushButton, )) self._selectionLayout = QtGui.QHBoxLayout() self._selectionLayout.addWidget(self._typeSelection, 1000) self._selectionLayout.addWidget(self._statusSelection, 1000) self._selectionLayout.addWidget(self._refreshButton, 0) self._itemStore = QtGui.QStandardItemModel() self._itemStore.setHorizontalHeaderLabels(["Messages"]) self._categoryManager = TimeCategories(self._itemStore) self._htmlDelegate = qui_utils.QHtmlDelegate() self._itemView = QtGui.QTreeView() self._itemView.setModel(self._itemStore) self._itemView.setUniformRowHeights(False) self._itemView.setRootIsDecorated(False) self._itemView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self._itemView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self._itemView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self._itemView.setHeaderHidden(True) self._itemView.setItemsExpandable(False) self._itemView.setItemDelegate(self._htmlDelegate) self._itemView.activated.connect(self._on_row_activated) self._itemView.header().sectionResized.connect(self._on_column_resized) self._layout = QtGui.QVBoxLayout() self._layout.addLayout(self._selectionLayout) self._layout.addWidget(self._itemView) self._widget = QtGui.QWidget() self._widget.setLayout(self._layout) self._populate_items()
def __init__(self, app, session, errorLog): self._selectedFilter = self.HISTORY_ITEM_TYPES[-1] self._app = app self._session = session self._session.historyUpdated.connect(self._on_history_updated) self._errorLog = errorLog self._typeSelection = QtGui.QComboBox() self._typeSelection.addItems(self.HISTORY_ITEM_TYPES) self._typeSelection.setCurrentIndex( self.HISTORY_ITEM_TYPES.index(self._selectedFilter) ) self._typeSelection.currentIndexChanged[str].connect(self._on_filter_changed) refreshIcon = qui_utils.get_theme_icon( ("view-refresh", "general_refresh", "gtk-refresh", ), _SENTINEL_ICON ) if refreshIcon is not _SENTINEL_ICON: self._refreshButton = QtGui.QPushButton(refreshIcon, "") else: self._refreshButton = QtGui.QPushButton("Refresh") self._refreshButton.clicked.connect(self._on_refresh_clicked) self._refreshButton.setSizePolicy(QtGui.QSizePolicy( QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.PushButton, )) self._managerLayout = QtGui.QHBoxLayout() self._managerLayout.addWidget(self._typeSelection, 1000) self._managerLayout.addWidget(self._refreshButton, 0) self._itemStore = QtGui.QStandardItemModel() self._itemStore.setHorizontalHeaderLabels(self.HISTORY_COLUMNS) self._categoryManager = TimeCategories(self._itemStore) self._itemView = QtGui.QTreeView() self._itemView.setModel(self._itemStore) self._itemView.setUniformRowHeights(True) self._itemView.setRootIsDecorated(False) self._itemView.setIndentation(0) self._itemView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self._itemView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self._itemView.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) self._itemView.setHeaderHidden(True) self._itemView.setItemsExpandable(False) self._itemView.header().setResizeMode(QtGui.QHeaderView.ResizeToContents) self._itemView.activated.connect(self._on_row_activated) self._layout = QtGui.QVBoxLayout() self._layout.addLayout(self._managerLayout) self._layout.addWidget(self._itemView) self._widget = QtGui.QWidget() self._widget.setLayout(self._layout) self._actionIcon = { "Placed": self._app.get_icon("placed.png"), "Missed": self._app.get_icon("missed.png"), "Received": self._app.get_icon("received.png"), } self._populate_items()