Skip to content

Commit

Permalink
Merge pull request #107 from bachradsusi/qt5-main
Browse files Browse the repository at this point in the history
Use the The New Python Enums
  • Loading branch information
pebenito authored Sep 5, 2023
2 parents 778f935 + 8c1a55d commit 9b4a77f
Show file tree
Hide file tree
Showing 57 changed files with 198 additions and 198 deletions.
2 changes: 1 addition & 1 deletion setoolsgui/apol/analysistab.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def clear_criteria_error(self, field, tooltip):
self._check_query()

def _check_query(self):
button = self.buttonBox.button(QDialogButtonBox.Apply)
button = self.buttonBox.button(QDialogButtonBox.StandardButton.Apply)
enabled = not self.errors
button.setEnabled(enabled)
button.setToolTip("Run the analysis." if enabled else "There are errors in the tab.")
Expand Down
8 changes: 4 additions & 4 deletions setoolsgui/apol/boolquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# setup indications of errors on level/range
self.errors = set()
self.orig_palette = self.name.palette()
self.error_palette = self.name.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_name_error()

# set up processing thread
Expand Down Expand Up @@ -105,7 +105,7 @@ def setupUi(self):
def get_detail(self):
# .ui is set for single item selection.
index = self.bools.selectedIndexes()[0]
item = self.bool_model.data(index, Qt.UserRole)
item = self.bool_model.data(index, Qt.ItemDataRole.UserRole)

self.log.debug("Generating detail window for {0}".format(item))
boolean_detail(self, item)
Expand Down Expand Up @@ -187,6 +187,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
6 changes: 3 additions & 3 deletions setoolsgui/apol/boundsquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(1, Qt.AscendingOrder)
self.table_results.sortByColumn(1, Qt.SortOrder.AscendingOrder)

# setup indications of errors on level/range
self.errors = set()
self.orig_palette = self.parent.palette()
self.error_palette = self.parent.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_parent_error()
self.clear_child_error()

Expand Down Expand Up @@ -189,6 +189,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
8 changes: 4 additions & 4 deletions setoolsgui/apol/categoryquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# setup indications of errors on level/range
self.errors = set()
self.orig_palette = self.name.palette()
self.error_palette = self.name.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_name_error()

# set up processing thread
Expand Down Expand Up @@ -105,7 +105,7 @@ def setupUi(self):
def get_detail(self):
# .ui is set for single item selection.
index = self.cats.selectedIndexes()[0]
item = self.category_model.data(index, Qt.UserRole)
item = self.category_model.data(index, Qt.ItemDataRole.UserRole)

self.log.debug("Generating detail window for {0}".format(item))
category_detail(self, item)
Expand Down Expand Up @@ -186,6 +186,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
2 changes: 1 addition & 1 deletion setoolsgui/apol/chooseanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def show(self, mls):
groupitem.addChild(item)

self.analysisTypes.expandAll()
self.analysisTypes.sortByColumn(0, Qt.AscendingOrder)
self.analysisTypes.sortByColumn(0, Qt.SortOrder.AscendingOrder)
super(ChooseAnalysis, self).show()

def accept(self, item=None):
Expand Down
10 changes: 5 additions & 5 deletions setoolsgui/apol/commonquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# setup indications of errors
self.errors = set()
self.orig_palette = self.name.palette()
self.error_palette = self.name.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_name_error()

# set up processing thread
Expand Down Expand Up @@ -116,7 +116,7 @@ def setupUi(self):
def get_detail(self):
# .ui is set for single item selection.
index = self.commons.selectedIndexes()[0]
item = self.common_model.data(index, Qt.UserRole)
item = self.common_model.data(index, Qt.ItemDataRole.UserRole)

self.log.debug("Generating detail window for {0}".format(item))
common_detail(self, item)
Expand Down Expand Up @@ -146,7 +146,7 @@ def set_name_regex(self, state):
def set_perms(self):
selected_perms = []
for index in self.perms.selectionModel().selectedIndexes():
selected_perms.append(self.perms_model.data(index, Qt.UserRole))
selected_perms.append(self.perms_model.data(index, Qt.ItemDataRole.UserRole))

self.query.perms = selected_perms

Expand Down Expand Up @@ -212,6 +212,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
10 changes: 5 additions & 5 deletions setoolsgui/apol/constraintquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def setupUi(self):
self.errors = set()
self.orig_palette = self.type_.palette()
self.error_palette = self.type_.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_user_error()
self.clear_type_error()
self.clear_role_error()
Expand All @@ -94,7 +94,7 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# set up processing thread
self.thread = QThread()
Expand Down Expand Up @@ -173,7 +173,7 @@ def clear_all_ruletypes(self):
def set_tclass(self):
selected_classes = []
for index in self.tclass.selectionModel().selectedIndexes():
selected_classes.append(self.class_model.data(index, Qt.UserRole))
selected_classes.append(self.class_model.data(index, Qt.ItemDataRole.UserRole))

self.query.tclass = selected_classes
self.perms_model.set_classes(selected_classes)
Expand All @@ -187,7 +187,7 @@ def invert_tclass_selection(self):
def set_perms(self):
selected_perms = []
for index in self.perms.selectionModel().selectedIndexes():
selected_perms.append(self.perms_model.data(index, Qt.UserRole))
selected_perms.append(self.perms_model.data(index, Qt.ItemDataRole.UserRole))

self.query.perms = selected_perms

Expand Down Expand Up @@ -323,6 +323,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
10 changes: 5 additions & 5 deletions setoolsgui/apol/defaultquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(1, Qt.AscendingOrder)
self.table_results.sortByColumn(1, Qt.SortOrder.AscendingOrder)

# populate class list
self.class_model = SEToolsListModel(self)
Expand Down Expand Up @@ -124,7 +124,7 @@ def clear_all_ruletypes(self):
def set_tclass(self):
selected_classes = []
for index in self.tclass.selectionModel().selectedIndexes():
selected_classes.append(self.class_model.data(index, Qt.UserRole))
selected_classes.append(self.class_model.data(index, Qt.ItemDataRole.UserRole))

self.query.tclass = selected_classes

Expand Down Expand Up @@ -163,10 +163,10 @@ def run(self, button):
rule_types.append(mode.objectName())

self.query.ruletype = rule_types
self.query.default = self.default_value.currentData(Qt.UserRole)
self.query.default = self.default_value.currentData(Qt.ItemDataRole.UserRole)

if self.default_range_value.isEnabled():
self.query.default_range = self.default_range_value.currentData(Qt.UserRole)
self.query.default_range = self.default_range_value.currentData(Qt.ItemDataRole.UserRole)
else:
self.query.default_range = None

Expand All @@ -193,6 +193,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
6 changes: 3 additions & 3 deletions setoolsgui/apol/dta.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def setupUi(self):
self.errors = set()
self.orig_palette = self.source.palette()
self.error_palette = self.source.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_source_error()
self.clear_target_error()

Expand Down Expand Up @@ -281,7 +281,7 @@ def browser_item_selected(self, current, previous):

print_transition(self.browser_details.appendPlainText, current.rules)

self.browser_details.moveCursor(QTextCursor.Start)
self.browser_details.moveCursor(QTextCursor.MoveOperation.Start)

if not current.child_populated:
self.busy.setLabelText("Gathering additional browser details for {0}...".format(
Expand Down Expand Up @@ -337,7 +337,7 @@ def update_complete(self):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

if self.flows_in.isChecked() or self.flows_out.isChecked():
# move to browser tab for transitions in/out
Expand Down
12 changes: 6 additions & 6 deletions setoolsgui/apol/excludetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ def setupUi(self):
if t not in self.initial_excluded_list]
self.included_sort = FilterByAttributeProxy(self)
self.included_sort.setSourceModel(self.included_model)
self.included_sort.sort(0, Qt.AscendingOrder)
self.included_sort.sort(0, Qt.SortOrder.AscendingOrder)
self.included_types.setModel(self.included_sort)

self.excluded_model = SEToolsListModel(self)
self.excluded_model.item_list = self.initial_excluded_list
self.excluded_sort = FilterByAttributeProxy(self)
self.excluded_sort.setSourceModel(self.excluded_model)
self.excluded_sort.sort(0, Qt.AscendingOrder)
self.excluded_sort.sort(0, Qt.SortOrder.AscendingOrder)
self.excluded_types.setModel(self.excluded_sort)

# connect signals
Expand All @@ -62,7 +62,7 @@ def include_clicked(self):
selected_types = []
for index in self.excluded_types.selectionModel().selectedIndexes():
source_index = self.excluded_sort.mapToSource(index)
item = self.excluded_model.data(source_index, Qt.UserRole)
item = self.excluded_model.data(source_index, Qt.ItemDataRole.UserRole)
self.included_model.append(item)
selected_types.append(item)

Expand All @@ -81,7 +81,7 @@ def exclude_clicked(self):
selected_types = []
for index in self.included_types.selectionModel().selectedIndexes():
source_index = self.included_sort.mapToSource(index)
item = self.included_model.data(source_index, Qt.UserRole)
item = self.included_model.data(source_index, Qt.ItemDataRole.UserRole)
self.excluded_model.append(item)
selected_types.append(item)

Expand All @@ -95,7 +95,7 @@ def exclude_clicked(self):

def set_attr_filter(self, row):
index = self.attr_model.index(row)
attr = self.attr_model.data(index, Qt.UserRole)
attr = self.attr_model.data(index, Qt.ItemDataRole.UserRole)
self.log.debug("Attribute set to {0!r}".format(attr))
self.included_sort.attr = attr
self.excluded_sort.attr = attr
Expand Down Expand Up @@ -126,7 +126,7 @@ def filterAcceptsRow(self, row, parent):
if self.attr:
source = self.sourceModel()
index = source.index(row)
item = source.data(index, Qt.UserRole)
item = source.data(index, Qt.ItemDataRole.UserRole)
if item not in self.attr:
return False

Expand Down
6 changes: 3 additions & 3 deletions setoolsgui/apol/fsusequery.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setupUi(self):
self.errors = set()
self.orig_palette = self.type_.palette()
self.error_palette = self.type_.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_fs_error()
self.clear_user_error()
self.clear_type_error()
Expand All @@ -86,7 +86,7 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(1, Qt.AscendingOrder)
self.table_results.sortByColumn(1, Qt.SortOrder.AscendingOrder)

# set up processing thread
self.thread = QThread()
Expand Down Expand Up @@ -312,6 +312,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
6 changes: 3 additions & 3 deletions setoolsgui/apol/genfsconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setupUi(self):
self.errors = set()
self.orig_palette = self.type_.palette()
self.error_palette = self.type_.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_fs_error()
self.clear_path_error()
self.clear_user_error()
Expand All @@ -87,7 +87,7 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# set up processing thread
self.thread = QThread()
Expand Down Expand Up @@ -312,6 +312,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
6 changes: 3 additions & 3 deletions setoolsgui/apol/ibendportconquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def setupUi(self):
self.errors = set()
self.orig_palette = self.type_.palette()
self.error_palette = self.type_.palette()
self.error_palette.setColor(QPalette.Base, Qt.red)
self.error_palette.setColor(QPalette.ColorRole.Base, Qt.GlobalColor.red)
self.clear_name_error()
self.clear_port_error()
self.clear_user_error()
Expand All @@ -87,7 +87,7 @@ def setupUi(self):
self.sort_proxy = QSortFilterProxyModel(self)
self.sort_proxy.setSourceModel(self.table_results_model)
self.table_results.setModel(self.sort_proxy)
self.table_results.sortByColumn(0, Qt.AscendingOrder)
self.table_results.sortByColumn(0, Qt.SortOrder.AscendingOrder)

# set up processing thread
self.thread = QThread()
Expand Down Expand Up @@ -304,6 +304,6 @@ def update_complete(self, count):
if not self.busy.wasCanceled():
self.busy.setLabelText("Moving the raw result to top; GUI may be unresponsive")
self.busy.repaint()
self.raw_results.moveCursor(QTextCursor.Start)
self.raw_results.moveCursor(QTextCursor.MoveOperation.Start)

self.busy.reset()
Loading

0 comments on commit 9b4a77f

Please sign in to comment.