Skip to content
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

Feature request: Embedded cutelog #16

Open
cdgriffith opened this issue Aug 23, 2020 · 1 comment
Open

Feature request: Embedded cutelog #16

cdgriffith opened this issue Aug 23, 2020 · 1 comment

Comments

@cdgriffith
Copy link

It would be nice to have a separate entry that used an existing QT MainWindow that would make cutelog easily added to other QT based programs.

Possibly add a way to pass through a custom program name as well, so it could display in the title bar "ProgramName Logs (powered by cutelog)" or similar.

@cdgriffith
Copy link
Author

So far I can launch it:

    def start_cutelog(self):
        from cutelog.main_window import MainWindow
        import sys
        if sys.platform == 'win32':
            import ctypes
            appid = 'busimus.cutelog'
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(appid)

        self.mw = MainWindow(logging.getLogger('my_log'), self)
        self.mw_close_event = self.mw.closeEvent
        self.mw.closeEvent = lambda x: print('nope')
        self.mw.hide()

    def show_logs(self):
        self.mw.show()

    def closeEvent(self, event):
        self.mw_close_event(event)
        super().closeEvent(event)

    def quit(self):
        pass # required as closeEvent() in cutelog calls parent_app.quit

Opens and closes fine.

But has an issue with resource paths (installed via pip)
Once a log message is sent:

  File "...venv/lib/python3.8/site-packages/cutelog/logger_tab.py", line 512, in setupUi
    self.ui = loadUi(CONFIG.get_ui_qfile('logger.ui'), baseinstance=self)
  File "..../venv/lib/python3.8/site-packages/cutelog/config.py", line 160, in get_ui_qfile
    raise FileNotFoundError('ui file not found: ":/ui/{}"'.format(name))
FileNotFoundError: ui file not found: ":/ui/logger.ui"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant