Skip to content

Instantly share code, notes, and snippets.

@altendky

altendky/x.py Secret

Created December 20, 2018 20:51
Show Gist options
  • Save altendky/6743848cdc18e10043fb0086b3ce57f1 to your computer and use it in GitHub Desktop.
Save altendky/6743848cdc18e10043fb0086b3ce57f1 to your computer and use it in GitHub Desktop.
import pathlib
import attr
import PyQt5.uic
Ui, UiBase = PyQt5.uic.loadUiType(
pathlib.Path(__file__).with_suffix('.ui'),
)
@attr.s
class FilesView(UiBase):
ui = attr.ib(factory=Ui)
@classmethod
def build(cls, parent):
instance = cls()
instance.setParent(parent)
return instance
def __attrs_post_init__(self):
super().__init__()
if self.ui is not None:
self.ui.setupUi(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment