-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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
Display improvements to PNG Info tab #16415
Open
MarcusNyne
wants to merge
20
commits into
AUTOMATIC1111:dev
Choose a base branch
from
MarcusNyne:m9-240816-pnginfo-text-copy
base: dev
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.
+318
−47
Open
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
efa87a6
Display features for PNG Info tab
MarcusNyne 54fc098
Fixed lint problems
MarcusNyne 56a3643
Copy string should replace ALL newlines
MarcusNyne 0a60577
Oops .. remove webui-test.bat
MarcusNyne 6730975
Fixed javascript linting
MarcusNyne eef1f1e
Improvements for pnginfo
MarcusNyne 6056a34
javascript lint
MarcusNyne d08d730
javascript linting
MarcusNyne 786809d
fixed a bug where copy animation remained
MarcusNyne 53712c6
Renamed pnginfo quick links
MarcusNyne 9fb7b07
add break-word for geninfo in pnginfo
w-e-w 400dd32
Merge branch 'dev' into m9-240816-pnginfo-text-copy
w-e-w 5968b87
preserve white spaces
w-e-w 56dc761
fix formating
w-e-w 913400a
reflector parse_generation_parameters
w-e-w 0309360
reimplement new pnginfo html with old method as fallback
w-e-w d679154
make PNG Info HTML style selectable
w-e-w 41bb886
geninfo-setting-string remove italic
w-e-w 8ea1325
lint
w-e-w 3f9efd5
remove quotes
w-e-w 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 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 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,57 @@ | ||
import re | ||
|
||
class PngParser: | ||
re_top_level = None | ||
re_top_level2 = None | ||
re_extra_newline = None | ||
re_parameters = None | ||
|
||
def __init__(self, pnginfo_string): | ||
PngParser.init_re() | ||
|
||
self.valid = self.parse_pnginfo(pnginfo_string) | ||
|
||
def parse_pnginfo(self, pnginfo_string): | ||
try: | ||
# separate positive, negative, and parameters | ||
m = PngParser.re_top_level.search(pnginfo_string) | ||
if m is None: | ||
m = PngParser.re_top_level2.search(pnginfo_string) | ||
if m is None: | ||
return False | ||
else: | ||
self.positive = m.group(1) | ||
self.negative = None | ||
self.parameters = m.group(2) | ||
else: | ||
self.positive = m.group(1) | ||
self.negative = m.group(2) | ||
self.parameters = m.group(3) | ||
|
||
self.extra = None | ||
self.settings = None | ||
|
||
# parse extra parameters (if they exist) by a newline outside of quotes | ||
m = PngParser.re_extra_newline.search(self.parameters) | ||
if m is not None: | ||
s = m.span() | ||
self.extra = self.parameters[s[1]:] | ||
self.parameters = self.parameters[:s[0]] | ||
|
||
# parse standard parameters | ||
self.settings = PngParser.re_parameters.findall(self.parameters) | ||
if self.settings is None: | ||
return False | ||
except Exception: | ||
return False | ||
|
||
return True | ||
|
||
@classmethod | ||
def init_re(cls): | ||
if cls.re_top_level is None: | ||
cls.re_top_level = re.compile(r'^(?P<positive>(?:.|\n)*)\nNegative prompt: (?P<negative>(?:.|\n)*)\n(?=Steps: )(?P<parameters>(?:.|\n)*)$') | ||
cls.re_top_level2 = re.compile(r'^(?P<positive>(?:.|\n)*)\nSteps: (?P<parameters>(?:.|\n)*)$') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I broke the parser There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
# cls.re_top_level2 = re.compile(r'^(?P<positive>(?:.|\n)*)\n(?=Steps: )(?P<parameters>(?:.|\n)*)$') | ||
cls.re_extra_newline = re.compile(r'\n(?=(?:[^"]*"[^"]*")*[^"]*$)') | ||
cls.re_parameters = re.compile(r'\s*(?P<param>[^:,]+):\s*(?P<quote>")?(?P<value>(?(2)(?:.)*?(?:(?<!\\)")|.*?))(?:\s*,\s*|$)') |
This file contains 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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another issue: items is discarded if
parser.valid
these are contains extra information that might be added on by stuff such as post-processing on extras tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@w-e-w Thank you for taking the time to go over this. I will take the time to look over the changes and test. It will take a few days. Thank you again!