-
Notifications
You must be signed in to change notification settings - Fork 4
Add support for specialized & network disks and advanced partitioning message bar #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jikortus
wants to merge
2
commits into
rhinstaller:main
Choose a base branch
from
jikortus:specialized-disks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
anabot/runtime/installation/hub/partitioning/specialized_disks/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| import logging | ||
| logger = logging.getLogger('anabot') | ||
|
|
||
| from fnmatch import fnmatchcase | ||
|
|
||
| from anabot.runtime.decorators import handle_action, handle_check, check_action_result | ||
| from anabot.runtime.functions import get_attr, getnode, getnodes, getsibling | ||
| from anabot.runtime.errors import TimeoutError | ||
| from anabot.runtime.translate import tr | ||
| from anabot.runtime.actionresult import NotFoundResult as NotFound, ActionResultPass as Pass, ActionResultFail as Fail | ||
|
|
||
| _local_path = '/installation/hub/partitioning/add_specialized_disk' | ||
| def handle_act(path, *args, **kwargs): | ||
| return handle_action(_local_path + path, *args, **kwargs) | ||
|
|
||
| def handle_chck(path, *args, **kwargs): | ||
| return handle_check(_local_path + path, *args, **kwargs) | ||
|
|
||
| def select_manipulate(element, app_node, local_node, dryrun): | ||
| name = get_attr(element, "names", "*") | ||
| action = get_attr(element, "action", "select") | ||
|
|
||
| try: | ||
| results_label = getnode(app_node, "label", tr("Search Res_ults:", context="GUI|Installation Destination|Filter|Search")) | ||
| table_pane = getsibling(results_label, 1, "scroll pane") | ||
| disks_table = getnode(table_pane, "table") | ||
| except TimeoutError: | ||
| return NotFound("results label, table pane or disks table") | ||
| cells = getnodes(disks_table, "table cell") | ||
| column_count = len(getnodes(disks_table, "table column header")) | ||
| # every table row has checkbox on position 0 and device name on 1 | ||
| name_cells = [ | ||
| c | ||
| for c in cells[1::column_count] | ||
| if fnmatchcase(c.name, name) | ||
| ] | ||
| checkbox_cells = [ | ||
| getsibling(c, -1, "table cell") | ||
| for c in name_cells | ||
| ] | ||
| logger.info("Devices that match name '%s' found: '%s'" % (name, [n.name for n in name_cells])) | ||
| for c in checkbox_cells: | ||
| if (action == "select") != (c.checked): | ||
| if dryrun: | ||
| return Fail("Checkbox status for device '%s' doesn't match required action '%s'" % (c.name, action)) | ||
| logger.info("Clicking on checkbox for device %s" % c.name) | ||
| c.click() | ||
| return Pass() | ||
|
|
||
| @handle_act('/select') | ||
| def select_handler(element, app_node, local_node): | ||
| return select_manipulate(element, app_node, local_node, False) | ||
|
|
||
| @handle_chck('/select') | ||
| def select_check(element, app_node, local_node): | ||
| return select_manipulate(element, app_node, local_node, True) | ||
|
|
||
| @handle_act('/done') | ||
| def done_handler(element, app_node, local_node): | ||
| try: | ||
| done_button = getnode(app_node, "push button", tr("_Done", drop_underscore=False, context="GUI|Spoke Navigation")) | ||
| except TimeoutError: | ||
| return NotFound("clickable Done button") | ||
| done_button.click() | ||
| return Pass() | ||
|
|
||
| @handle_chck('/done') | ||
| @check_action_result | ||
| def done_check(element, app_node, local_node): | ||
| return Pass() | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.