Giter VIP home page Giter VIP logo

Comments (10)

cjerrington avatar cjerrington commented on May 23, 2024 1

It looks like there are some icons already added as resources to the QT app. Could we add the icon.ico file and the style.css file to the resources for the QT window and this might allow us to either to

  1. eliminate an extra image or
  2. keep all the files internal to the project so we might be able to get a single file when compiling.

Found this article too https://www.learnpyqt.com/tutorials/packaging-pyqt5-pyside2-applications-windows-pyinstaller/

from pydebloatx.

cjerrington avatar cjerrington commented on May 23, 2024 1

Okay, I might have figured it out!

Seems to be an issue with the --window command. removing that seems to help. We do see the "command prompt" window before the GUI appears.

Build command:

pyinstaller --noconfirm --onefile --name "PyDebloatX" --icon "pydebloatx/icon.ico" --add-data "pydebloatx/icon.ico;." --add-data "pydebloatx/style.css;."  "pydebloatx/app.py"

I did update the resource paths to use the function as described in the posted articles.

def resource_path(relative_path):
  if hasattr(sys, 'frozen'):
      return os.path.join(sys._MEIPASS, relative_path)
  return os.path.join(os.path.abspath('.'), relative_path)

Then updating the places the icon.ico and style.css files are referenced with an example below.

self.setWindowIcon(QIcon(resource_path('./icon.ico')))
...
with open(resource_path('./style.css'), 'r') as file:

At the first steps we do have a single, portable file. Aesthetically we would want the console window hidden, but the end result is still one file. It is a little slower to open as @Teraskull mentioned as it is extracting files to the %Temp% folder before running. and once we close the application it deletes the the temp directory.

I can create a pull request if you'd like to make these changes.

from pydebloatx.

Teraskull avatar Teraskull commented on May 23, 2024

Hi, thanks for this idea, but isn't the setup installer already making it kind of portable? It just creates a folder on the desktop, which you can put on a flash drive, and it will work the same way.

Regarding custom settings, what exactly are you thinking of? Something like saving a preset of selected apps?

from pydebloatx.

cjerrington avatar cjerrington commented on May 23, 2024

pyinstaller does allow for the --onefile command but will need to look into adding the dependencies or missing imports more as once compiled the app gave an error stating "Failed to execute script app".

After looking into this there might need to be changes on how the resources get referenced as the onefile method does create a runtime folder and the files might not be extracted to this location. When adding the icon.ico and the style.css to the same directory as the compiled exe the window launches but then closes out.

from pydebloatx.

Teraskull avatar Teraskull commented on May 23, 2024

As you said, --onefile is not possible with this software, since there is a separate css file. Also, what --onefile does, is unpack everything in some temp folder on Windows, which I think is not very portable. A lot better would be just to store the folder from the desktop. It also would take more time to launch, because of the unpacking.

from pydebloatx.

cjerrington avatar cjerrington commented on May 23, 2024

I agree with @Teraskull and when the app is compiled to the --onedir it does place it in its own Directory for that portability and not just one file.

While looking into this there does seem like it could still be possible. When running once compiled there is an __MEIPASS folder and we need to add some additional references to a new location but I've yet to get it working completely yet as one file.

from pydebloatx.

space9bug avatar space9bug commented on May 23, 2024

The startup process of one file is really slow. You can add a compressed package (compress the files after the build) as a portable version (*.zip or *.7z).

from pydebloatx.

Teraskull avatar Teraskull commented on May 23, 2024

It would be harder to edit the style.css, as it would need to be generated each time you change something. Also, since the latest PR, there will be language translation files, which won't be possible to pack into the resource file.

from pydebloatx.

cjerrington avatar cjerrington commented on May 23, 2024

With pull request #36 we can mark this issue as complete. Thanks for the idea @designjeevan and @Teraskull for letting me help!

from pydebloatx.

Teraskull avatar Teraskull commented on May 23, 2024

Thank you for your work @cjerrington! Closed until any new issues arise.

from pydebloatx.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.