Chicago95 icon indicating copy to clipboard operation
Chicago95 copied to clipboard

PlusGUI.py fails converting Windows 98 Plus! theme

Open seadra opened this issue 2 years ago • 8 comments

When I tried installing the Windows 98 Jungle theme with ../PlusGUI.py ../Jungle/Jungle.theme, PlusGUI.py failed with

Traceback (most recent call last):
  File "/home/user/src/Chicago95/Plus/tmp/../PlusGUI.py", line 1207, in install_accept
    self.install_theme()
  File "/home/user/src/Chicago95/Plus/tmp/../PlusGUI.py", line 1232, in install_theme
    self.theme.go(cursors=self.install_cursors, icons=self.install_icons, wallpaper=self.install_wallpaper, 
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 155, in go
    self.generate_theme(cursors, icons, wallpaper, sounds, colors, fonts, screensaver)
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 274, in generate_theme
    self.convert_colors()
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 1261, in convert_colors
    self.theme_config['colors']['buttondkshadow']['color'], 
KeyError: 'buttondkshadow'

seadra avatar Jun 05 '22 05:06 seadra

Looks like a different problem but Dangerous Creatures fails with the following inkscape problem (inkscape 1.2, Arch Linux)

Traceback (most recent call last):
  File "/home/user/src/Chicago95/Plus/tmp/../PlusGUI.py", line 1207, in install_accept
    self.install_theme()
  File "/home/user/src/Chicago95/Plus/tmp/../PlusGUI.py", line 1232, in install_theme
    self.theme.go(cursors=self.install_cursors, icons=self.install_icons, wallpaper=self.install_wallpaper, 
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 155, in go
    self.generate_theme(cursors, icons, wallpaper, sounds, colors, fonts, screensaver)
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 268, in generate_theme
    self.create_icons()
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 972, in create_icons
    svg_icon_file = self.convert_icon(self.folder_names['icons'], self.folder_names['icons']+icon_filename)
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 2452, in convert_icon
    self.fix_with_inkscape( rgbs[rgb] , tmp_file )
  File "/home/user/src/Chicago95/Plus/pluslib.py", line 2511, in fix_with_inkscape
    subprocess.check_call(args, stderr=subprocess.DEVNULL ,stdout=subprocess.DEVNULL)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[b'/usr/bin/inkscape', '-g', '--select=rect4', '--verb', 'EditSelectSameFillColor;SelectionCombine;SelectionUnion;FileSave;FileQuit', '/home/user/src/Chicago95/Plus/chicago95_tmp_file.svg']' returned non-zero exit status 1.

seadra avatar Jun 05 '22 05:06 seadra

I'm having a similar problem with every theme, mostly trying to use the Jimmy Buffet theme, but it won't apply, I'm on Debian Unstable

Installing` theme with the following options:
Theme File: /home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett (High Color).Theme
Inkscape Options:
	Colors: 32 Overlap: 1 Squaresize: 20
Install Directory: /home/filly/Chicago95/Plus
Paths:
	Cursor Path: /home/filly/.icons/Chicago95_Cursor_Black
	Theme Path: /home/filly/.themes/Chicago95
	Icons Path: /home/filly/.icons/Chicago95
Install (checkbox) Options:
	Cursors: True
	Icons: True
	Wallpaper: False
	Sounds: False
	Colors: True
	Fonts: True
	Screensaver: False
INFO     :: go                     :: Starting Chicago Plus! with the folowing settings: cursors=True, icons=True, wallpaper=False, sounds=False, colors=True, fonts=True, screensaver=False
INFO     :: check_software         :: Checking for required installed software
INFO     :: parse_icons            :: Parsing Icons
INFO     :: parse_icons            :: my_computer           | ('jimmy buffett my computer.ico', '0')
INFO     :: parse_icons            :: my_documents          | False
INFO     :: parse_icons            :: network_neighborhood  | ('jimmy buffett network neighborhood.ico', '0')
INFO     :: parse_icons            :: recycle_bin_full      | ('jimmy buffett recycle full.ico', '0')
INFO     :: parse_icons            :: recycle_bin_empty     | ('jimmy buffett recycle empty.ico', '0')
INFO     :: parse_cursors          :: Parsing Control Panel\Cursors
INFO     :: parse_cursors          :: arrow                 | {'type': 'cur', 'filename': 'jimmy buffett arrow.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Arrow.cur'}
INFO     :: parse_cursors          :: help                  | {'type': 'cur', 'filename': 'jimmy buffett help.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Help.cur'}
INFO     :: parse_cursors          :: appstarting           | {'type': 'ani', 'filename': 'jimmy buffett wait.ani', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Wait.ani'}
INFO     :: parse_cursors          :: wait                  | {'type': 'ani', 'filename': 'jimmy buffett busy.ani', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Busy.ani'}
INFO     :: parse_cursors          :: nwpen                 | {'type': 'cur', 'filename': 'jimmy buffett pen.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Pen.cur'}
INFO     :: parse_cursors          :: no                    | {'type': 'cur', 'filename': 'jimmy buffett no.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett No.cur'}
INFO     :: parse_cursors          :: sizens                | {'type': 'cur', 'filename': 'jimmy buffett ns.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett NS.cur'}
INFO     :: parse_cursors          :: sizewe                | {'type': 'cur', 'filename': 'jimmy buffett we.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett WE.cur'}
INFO     :: parse_cursors          :: crosshair             | {'type': 'cur', 'filename': 'jimmy buffett cross.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Cross.cur'}
INFO     :: parse_cursors          :: ibeam                 | {'type': 'cur', 'filename': 'jimmy buffett beam.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Beam.cur'}
INFO     :: parse_cursors          :: sizenwse              | {'type': 'cur', 'filename': 'jimmy buffett nwse.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett NWSE.cur'}
INFO     :: parse_cursors          :: sizenesw              | {'type': 'cur', 'filename': 'jimmy buffett nesw.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett NESW.cur'}
INFO     :: parse_cursors          :: sizeall               | {'type': 'cur', 'filename': 'jimmy buffett move.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Move.cur'}
INFO     :: parse_cursors          :: uparrow               | {'type': 'cur', 'filename': 'jimmy buffett up.cur', 'path': '/home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Up.cur'}
INFO     :: parse_cursors          :: defaultvalue          | False
INFO     :: parse_wallpaper        :: Parsing Control Panel\Desktop Wallpaper
INFO     :: parse_wallpaper        :: wallpaper             | jimmy buffett wallpaper.jpg
INFO     :: parse_wallpaper        :: tilewallpaper         | False
INFO     :: parse_wallpaper        :: wallpaperstyle        | 2
INFO     :: parse_wallpaper        :: filename              | 
INFO     :: parse_wallpaper        :: path                  | /home/filly/Chicago95/Plus/jbuffett/Jimmy Buffett Wallpaper.jpg
INFO     :: parse_wallpaper        :: new_filename          | jimmy buffett wallpaper_0_2.jpg
INFO     :: parse_sound_files      :: Parsing sounds
INFO     :: parse_sound_files      :: AppGPFault            | jimmy buffett program error.wav
INFO     :: parse_sound_files      :: .Default              | jimmy buffett default.wav
INFO     :: parse_sound_files      :: Maximize              | jimmy buffett sound!.wav
INFO     :: parse_sound_files      :: MenuCommand           | jimmy buffett menu command.wav
INFO     :: parse_sound_files      :: MenuPopup             | jimmy buffett menu popup.wav
INFO     :: parse_sound_files      :: Minimize              | jimmy buffett sound!.wav
INFO     :: parse_sound_files      :: RestoreDown           | jimmy buffett sound!.wav
INFO     :: parse_sound_files      :: RestoreUp             | jimmy buffett sound!.wav
INFO     :: parse_sound_files      :: SystemAsterisk        | jimmy buffett asterisk.wav
INFO     :: parse_sound_files      :: SystemDefault         | jimmy buffett default.wav
INFO     :: parse_sound_files      :: SystemExclamation     | jimmy buffett exclamation.wav
INFO     :: parse_sound_files      :: SystemExit            | jimmy buffett exit windows.wav
INFO     :: parse_sound_files      :: SystemHand            | jimmy buffett critical stop.wav
INFO     :: parse_sound_files      :: SystemQuestion        | jimmy buffett question.wav
INFO     :: parse_sound_files      :: SystemStart           | jimmy buffett start windows.wav
INFO     :: parse_sound_files      :: EmptyRecycleBin       | jimmy buffett empty recycle bin.wav
INFO     :: parse_nonclientmetrics :: Parsing NonClientMetrics
INFO     :: parse_iconmetrics      :: Parsing IconMetrics
INFO     :: parse_colors           :: Parsing Control Panel\Colors
INFO     :: parse_colors           :: activetitle           | #ff8080 (255 128 128) desc: Title bar active color
INFO     :: parse_colors           :: background            | #ff8080 (255 128 128) desc: desktop area, with no wallpaper applied
INFO     :: parse_colors           :: hilight               | #c0dcc0 (192 220 192) desc: background color of a selection
INFO     :: parse_colors           :: hilighttext           | #000000 (0 0 0      ) desc: foreground text color of the selection
INFO     :: parse_colors           :: titletext             | #000000 (0 0 0      ) desc: Title bar text color for active windows
INFO     :: parse_colors           :: window                | #ffffff (255 255 255) desc:  main background color inside a window, typically white
INFO     :: parse_colors           :: windowtext            | #000000 (0 0 0      ) desc: the main text inside a window
INFO     :: parse_colors           :: scrollbar             | #e0e0e0 (224 224 224) desc: color of the scrollbar TRACK, scrollbar itself drawn using 3D Button attributes
INFO     :: parse_colors           :: inactivetitle         | #808080 (128 128 128) desc: Title bar color for inactive windows
INFO     :: parse_colors           :: menu                  | #c0c0c0 (192 192 192) desc: color of a menu, overrides the ButtonFace attribute
INFO     :: parse_colors           :: windowframe           | #000000 (0 0 0      ) desc: typically the single line border seen around active buttons
INFO     :: parse_colors           :: menutext              | #000000 (0 0 0      ) desc: shown on the MenuBar and Menus
INFO     :: parse_colors           :: activeborder          | #c0c0c0 (192 192 192) desc:  border of the active window, drawn inside the 3D colors
INFO     :: parse_colors           :: inactiveborder        | #c0c0c0 (192 192 192) desc: border of the inactive window, drawn inside the 3D colors
INFO     :: parse_colors           :: appworkspace          | #7f7f7f (127 127 127) desc: background color in an application that may contain windows, such as GIMP
INFO     :: parse_colors           :: buttonface            | #c0c0c0 (192 192 192) desc: main button color
INFO     :: parse_colors           :: buttonshadow          | #808080 (128 128 128) desc: bottom/right inside
INFO     :: parse_colors           :: graytext              | #808080 (128 128 128) desc: Unknown, MS documentation is inaccurate
INFO     :: parse_colors           :: buttontext            | #000000 (0 0 0      ) desc: shown on 3D Buttons
INFO     :: parse_colors           :: inactivetitletext     | #fffcf0 (255 252 240) desc: Title bar text color for inactive windows
INFO     :: parse_colors           :: buttonhilight         | #e0e0e0 (224 224 224) desc: top/left outside
INFO     :: parse_colors           :: buttondkshadow        | #000000 (0 0 0      ) desc: bottom/right outside
INFO     :: parse_colors           :: buttonlight           | #c0c0c0 (192 192 192) desc: top/left inside
INFO     :: parse_colors           :: infotext              | #000000 (0 0 0      ) desc: tooltip text color
INFO     :: parse_colors           :: infowindow            | #ffffff (255 255 255) desc: the color of the tooltip itself (default is a light yellow)
INFO     :: parse_screensaver      :: Parsing Boot (screensaver)
INFO     :: parse_screensaver      :: screensaver           | guitoons.scr
INFO     :: install_folders        :: Install folder names
INFO     :: install_folders        :: root                  | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/
INFO     :: install_folders        :: icons                 | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Icons/
INFO     :: install_folders        :: theme                 | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Theme/
INFO     :: install_folders        :: cursors               | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Cursors/
INFO     :: install_folders        :: sounds                | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Sounds/
INFO     :: install_folders        :: screensaver           | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Screensaver/
INFO     :: install_folders        :: fonts                 | /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Fonts/
INFO     :: create_cursors         :: Creating new xcursors in /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Cursors/
INFO     :: create_cursors         :: arrow                 | file: jimmy buffett arrow.cur
INFO     :: create_cursors         :: help                  | file: jimmy buffett help.cur
INFO     :: create_cursors         :: appstarting           | file: jimmy buffett wait.ani
INFO     :: create_cursors         :: wait                  | file: jimmy buffett busy.ani
INFO     :: create_cursors         :: nwpen                 | file: jimmy buffett pen.cur
INFO     :: create_cursors         :: no                    | file: jimmy buffett no.cur
INFO     :: create_cursors         :: sizens                | file: jimmy buffett ns.cur
INFO     :: create_cursors         :: sizewe                | file: jimmy buffett we.cur
INFO     :: create_cursors         :: crosshair             | file: jimmy buffett cross.cur
INFO     :: create_cursors         :: ibeam                 | file: jimmy buffett beam.cur
INFO     :: create_cursors         :: sizenwse              | file: jimmy buffett nwse.cur
INFO     :: create_cursors         :: sizenesw              | file: jimmy buffett nesw.cur
INFO     :: create_cursors         :: sizeall               | file: jimmy buffett move.cur
INFO     :: create_cursors         :: uparrow               | file: jimmy buffett up.cur
INFO     :: create_icons           :: Creating new icons in /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Icons/
INFO     :: create_icons           :: my_computer           | jimmy buffett my computer.ico
INFO     :: convert_icon           ::                       | Inkscape will open 6 times to process /home/filly/Chicago95/Plus/Jimmy_buffett_(high_color)_Chicago95/Jimmy_buffett_(high_color)_Icons/Jimmy Buffett My Computer_0_32x32x16.svg
INFO     :: convert_icon           ::                       | [1   / 6   17.0 ] Converting rgb(0,0,0)
Traceback (most recent call last):
  File "/home/filly/Chicago95/Plus/./PlusGUI.py", line 1213, in install_ok
    self.install_theme()
  File "/home/filly/Chicago95/Plus/./PlusGUI.py", line 1232, in install_theme
    self.theme.go(cursors=self.install_cursors, icons=self.install_icons, wallpaper=self.install_wallpaper, 
  File "/home/filly/Chicago95/Plus/pluslib.py", line 155, in go
    self.generate_theme(cursors, icons, wallpaper, sounds, colors, fonts, screensaver)
  File "/home/filly/Chicago95/Plus/pluslib.py", line 268, in generate_theme
    self.create_icons()
  File "/home/filly/Chicago95/Plus/pluslib.py", line 972, in create_icons
    svg_icon_file = self.convert_icon(self.folder_names['icons'], self.folder_names['icons']+icon_filename)
  File "/home/filly/Chicago95/Plus/pluslib.py", line 2452, in convert_icon
    self.fix_with_inkscape( rgbs[rgb] , tmp_file )
  File "/home/filly/Chicago95/Plus/pluslib.py", line 2511, in fix_with_inkscape
    subprocess.check_call(args, stderr=subprocess.DEVNULL ,stdout=subprocess.DEVNULL)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[b'/usr/bin/inkscape', '-g', '--select=rect4', '--verb', 'EditSelectSameFillColor;SelectionCombine;SelectionUnion;FileSave;FileQuit', '/home/filly/Chicago95/Plus/chicago95_tmp_file.svg']' returned non-zero exit status `1.

This is what the terminal says with Verbose on

Mitchykins avatar Jul 15 '22 23:07 Mitchykins

Looks to me like there's a problem with our inkscape integration (again). I'll take a look on a new Xubuntu install

grassmunk avatar Jul 17 '22 16:07 grassmunk

From what I've come to understand, Inkscape 1.2 dropped the ability to use verbs, and now expects you to use actions. Inkscape 1.2 released in May 2022, which would be right around when this broke. Unfortunately, I don't know enough about inkscape to fix this issue.

Quick-and-dirty Workaround for the end user:

Option 1: Just don't apply icons. Inkscape only seems to be erroring when used for icon converting. If icons aren't especially important to you, just uncheck that box and everything else applies correctly.

Option 2: Grab the AppImage for Inkscape 1.1 from their releases page, set the execute bit, rename the AppImage executable to inkscape, and drop it in your path someplace. Since I already had ~/.local/bin in my path, I dropped it there. Everything works as expected.

Potential Long Term solutions:

Option 1: Somebody who actually uses inkscape on a daily basis and knows how the command line options work for out would suss out the correct incantations to fix the script.

Option 2: Just remove the fix_with_inkscape() routine altogether. Is what we're doing with inkscape in this situation actually necessary? I commented out the call to the routine, and everything appears to be generating correctly. Admittedly, I've only tried with two different themes - Space (256 Color) and Inside Your Computer (High Color) - so it's possible a non-microsoft Plus compatible theme from a third party might have breaking behavior.

philberthfz avatar May 15 '23 22:05 philberthfz

I can explain why we do this, and whats happening. Most themes come with icons for garbage, my computer, etc. We would like to use these icons. Problem is sometimes the icons are tiny (32x32 or less) and so we convert the icons files in python to SVG files where each pixel is a small square. This is fine until the SVG file is expanded from 32x32 to something like 512x512 or even 128x128. When that happens the icon becomes transparent because of all the little squares. What inkscape does is combine all the same color pixels in to one shape, making them opaque.

The verbs being used are:

EditSelectSameFillColor;
SelectionCombine;
SelectionUnion;
FileSave;
FileQuit

I believe export-do replaces FileSave;FileQuit but I don't have the time or a version of inkscape to figure out what replaces EditSelectSameFillColor;SelectionCombine;SelectionUnion if someone wants to figure that out and lets me know what the actions are to replace the current verbs I have no problem adding another if/then/else to line 2511 in pluslib.py if the inkscape version is > 1.1.

Failing that I would love to hear any other suggestions for fixing SVGs in python so they don't look transparent

grassmunk avatar May 16 '23 19:05 grassmunk

I made a custom path to my build of inkscape 1.1, how do I tell Chicago95 to ignore the default Inkscape path and look for it in my custom path?

TerryTRSPanda avatar Jun 11 '23 23:06 TerryTRSPanda

I made a custom path to my build of inkscape 1.1, how do I tell Chicago95 to ignore the default Inkscape path and look for it in my custom path?

Add export PATH="$PATH:/yourlocation" to the bottom of your .profile Replace /yourlocation with whatever path you've installed inkscape to. In my case, inkscape was in my local bins folder (~/.local/bin), but you could have put it someplace else.

.profile on many Linuxen only gets loaded on login, so if you do put it there you may have to log out and log back in (or just restart). You can tell if you were successful if you execute which inkscape and it returns the path to your custom build, or by running inkscape --version and checking that the version string it prints is the correct version.

Of course, if you don't already have inkscape installed, and your were feeling particularly risky, you could just drop a link to your build inside /usr/bin or similar. I do not recommend this because of potential conflicts with any version of inkscape you may try to install in the future, and also because I think dropping stuff in /usr/bin on a whim is a bad habit to get into.

philberthfz avatar Jun 12 '23 01:06 philberthfz

It says inkscape 1.0.2 and still doesn't work

TerryTRSPanda avatar Jun 12 '23 14:06 TerryTRSPanda