Skip to content

Commit

Permalink
Merge pull request #228 from ales-erjavec/fixes/argparse-unhashable-type
Browse files Browse the repository at this point in the history
[FIX] application: Fix argparse type error
  • Loading branch information
markotoplak committed Mar 31, 2022
2 parents 5c6ccbd + d90b29f commit 3616512
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/run-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:
python-version: 3.7
test-env: "PyQt5~=5.12.0"

- os: ubuntu-20.04
python-version: 3.6
test-env: "PyQt5~=5.15.0"

- os: ubuntu-20.04
python-version: 3.7
test-env: "PyQt5~=5.15.0"

- os: ubuntu-20.04
python-version: 3.8
test-env: "PyQt5~=5.14.0"
Expand Down
6 changes: 5 additions & 1 deletion orangecanvas/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ def argumentParser():
os.environ.get("QT_SCALE_FACTOR_ROUNDING_POLICY"),
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)

def converter(value):
# dict.get wrapper due to https://bugs.python.org/issue16516
return HighDpiScaleFactorRoundingPolicyLookup.get(value)
parser.add_argument(
"-scale-factor-rounding-policy",
type=HighDpiScaleFactorRoundingPolicyLookup.get,
type=converter,
choices=[*HighDpiScaleFactorRoundingPolicyLookup.values(), None],
default=default,
)
Expand Down
6 changes: 6 additions & 0 deletions orangecanvas/application/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def test_application(self):
])
self.assertEqual(res.returncode, 0)

def test_application_help(self):
res = sh.python_run([
"-m", "orangecanvas", "--help"
])
self.assertEqual(res.returncode, 0)


def remove_after_exit(fname):
appmod.run_after_exit([
Expand Down

0 comments on commit 3616512

Please sign in to comment.