#๐Ÿ”’ Qt Widgets disappear?

83 messages ยท Page 1 of 1 (latest)

glossy tulip
fringe lanternBOT
#

@glossy tulip

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

glossy tulip
#

ive discovered that they disappear instantly if i dont focus the window and if i spawn it and immediently focus it it shows until i unfocus!

#

dont know how that makes any sense though

trim falcon
glossy tulip
trim falcon
trim falcon
#

If I remember there's a way to execute a lambda on the widgets when destroy happens

#

May have to look it up though

#

widget.destroyed.connect(lambda: print("Widget is destroyed"))

Google search tells me this

glossy tulip
glad crag
#
def get_tasks(self):
        tasks = []
        for proc in psutil.process_iter(["pid", "name"]):
            try:
                tasks.append({"pid": proc.info["pid"], "name": proc.info["name"]})
            except (psutil.NoSuchProcess, psutil.AccessDenied):
                continue
        return tasks
#

check if this exception is thrown

#

here you continue so you have no idea

glossy tulip
glad crag
#

oh ok

#
def update_tasks(self):
        all_tasks = self.get_tasks()
        grouped = {}
        for task in all_tasks:
            grouped.setdefault(task["name"], []).append(task["pid"])

        for widget in self.task_widgets:
            widget.setParent(None)
        self.task_widgets.clear()

        for name, pids in grouped.items():
            task_widget = Task(name, pids)
            self.task_widgets.append(task_widget)
            self.addWidget(task_widget)
#

then it must be this function

glossy tulip
#

not when that is called tho

glad crag
#

oh it's only then?

#

so those widgets only dissappear when you don't focus?

glad crag
#

okay so it has to be something with the event loop of focussing I think

glossy tulip
#

another wierd artifact is that the disk progress bars and the ram progress bar (Meter) stays on 100% (cpu meter is unaffected) when focused, then go back to normal when unfocusing

glad crag
#

okay so yeah it's gotta do with that

#

        for widget in self.task_widgets:
            widget.setParent(None)
        self.task_widgets.clear()
#

why do you do this exactly?

glossy tulip
glad crag
#

if you increase the OneShot

#

does that affect when they disappear if you unfocus sooner?

#

wait nvm

#

shouldn't matter

glossy tulip
#

if its unfocused when the function is called it disappeares almost instantly

glad crag
#

hmm

#

the thing is, is it only visual or also in the data

glossy tulip
glad crag
#

i've downloaded your repo imma check on my end

glossy tulip
#

so its just visual

#

but what would cause them to stop rendering

#

also if i focus the window again they dont reappear

glossy tulip
glad crag
glossy tulip
#

also the bar problem doesnt happen if i remove thhe TaskSection from the window from the start

glossy tulip
#

note that it focuses on hover

glad crag
#

yeah

glossy tulip
#

why are the progressbars even affected ๐Ÿ˜ญ

glad crag
#

there's something with your settings

glossy tulip
#

wdym

glad crag
#

hahah

glossy tulip
glad crag
#

so that might explain the bars

glossy tulip
#

but why is the tasks disappearing

glad crag
#

it isn't for me

#

Are you on wayland?

glossy tulip
glad crag
#

your cmd showed an error

#

or like a remark

#

so that might also explain the weird full screen on my end

#

Also so do you click on your cmd or just stop hovering your mouse over the app?

#

because when I unhover, the PIDs stay

#

when I click away it minimizes because the always on top setting is not on

glossy tulip
glad crag
#

okay I'll enable always on top and see if the PIDs disappear

#

btw here I would not do Expanding

#

nvm it's for vertical

glossy tulip
glad crag
#

the PIDs are still there

#

so it may be OS

glossy tulip
glossy tulip
#

i think i kinda solved it

#

!close

fringe lanternBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.