def _registry_(self, action): registry = reg.createDialog( ctx.getInstance().getTemplatePath('registry.ui'), ctx.getInstance().getImagePath('registry_icon.png')) registry.show() registry.setModal(True) registry.exec()
def main(): init() app = QApplication(sys.argv) wLogin = lg.createLogin( ctx.getInstance().getTemplatePath('main_dialog.ui'), ctx.getInstance().getImagePath('login_icon.png')) wLogin.show() sys.exit(app.exec_())
def _ok_(self): t = '가입돼었습니다.' if len(self.le_email.text()) == 0 or len(self.le_pwd.text()) == 0: t = 'email 과 암호를 체크하세요.' else: context = ctx.getInstance() authenticationManager = context.getComponent(mam.__file__) authenticationManager.createMember(email=self.le_email.text(), pwd=self.le_pwd.text()) popup = cdp.createDialog() popup.setText(t) \ .setIConImage({'path': ctx.getInstance().getImagePath("alert_icon.png"), "w": 62, "h": 52}) \ .setButtons([ {'text': 'OK', 'listener': lambda p: print('{}'.format(p))} ]).show() popup.exec() self.close()
def getLayout(): form_class = uic.loadUiType( ctx.getInstance().getTemplatePath('registry_layout.ui'))[0] class RegistryLayout(QWidget, form_class, BaseView): def __init__(self): QWidget.__init__(self) self.setupUi(self) def getLayout(self): return self.container_registry registryLayout = RegistryLayout() return registryLayout.getLayout()
def _login_(self): context = ctx.getInstance() authenticationManager = context.getComponent(mam.__file__) if authenticationManager.certification( self.le_email.text(), self.le_password.text()) == False: self.tb_invalid_notify.show() else: import src.python.manager.security_context_holder as sch securityContextHolder = context.getComponent(sch.__file__) securityContextHolder.setAuthentication( authenticationManager.getMember(self.le_email.text())) print('login Success ---> {}'.format(securityContextHolder)) self.gb_login.deleteLater() registryLayout = getLayout() dir(self.gb_login)
def createDialog(): form_class = uic.loadUiType( ctx.getInstance().getTemplatePath('custom_alert_popup.ui'))[0] class CustomAlertPopup(QDialog, form_class, BaseView): TEXT_STYLE = 'font-size:20px;' def __init__(self): QDialog.__init__(self) self.setupUi(self) def _click_(self, _listener): _listener('hi') self.close() def setText(self, _text): self.lbl_text.setText(_text) self._setStyle_((self.lbl_text, ), _style=CustomAlertPopup.TEXT_STYLE) return self def setIConImage(self, _image_info): iconImg = QPixmap() iconImg.load(_image_info['path']) iconImg = iconImg.scaledToWidth(_image_info['w']) iconImg = iconImg.scaledToHeight(_image_info['h']) self.lbl_alert_icon.setPixmap(iconImg) return self def setButtons(self, buttonDatas): if len(buttonDatas) > 3 or len(buttonDatas) == 0: raise Exception("최소 1 최대 3 개의 button만 만들수 있습니다.") layout = QHBoxLayout() for idx, button_info in enumerate(buttonDatas): btn = QPushButton(button_info['text'], self) btn.setCheckable(True) btn.toggle() btn.clicked.connect( partial(self._click_, button_info['listener'])) layout.addWidget(btn) self.gb_button.setLayout(layout) return self return CustomAlertPopup()
def getInstance(): form_class = uic.loadUiType( ctx.getInstance().getTemplatePath('main.ui'))[0] class MPWMain(QDialog, form_class, BaseView): TEXT_STYLE_1 = 'font-size:14px;font-weight:bold;' def __init__(self): QDialog.__init__(self) self.setupUi(self) self._setLayout_() def _setLayout_(self): self._setStyle_((self.lbl_userinfo, ), _style=MPWMain.TEXT_STYLE_1) # self._setStyle_((self.btn_logout,) , _style=MPWMain.BUTTON_STYLE_1) return MPWMain()
if authenticationManager.certification( self.le_email.text(), self.le_password.text()) == False: self.tb_invalid_notify.show() else: import src.python.manager.security_context_holder as sch securityContextHolder = context.getComponent(sch.__file__) securityContextHolder.setAuthentication( authenticationManager.getMember(self.le_email.text())) print('login Success ---> {}'.format(securityContextHolder)) self.gb_login.deleteLater() registryLayout = getLayout() dir(self.gb_login) # self.gb_login.deleteLater() return Login() if __name__ == '__main__': import src.python.defines.defines as df df.initRepositoryPath(__file__) app = QApplication(sys.argv) winlogin = createLogin(ctx.getInstance().getTemplatePath('main_dialog.ui'), ctx.getInstance().getImagePath('login_icon.png')) winlogin.show() app.exec_()
def init(): # ApplicationContext 생성 ctx.getInstance()
partial(self._click_, button_info['listener'])) layout.addWidget(btn) self.gb_button.setLayout(layout) return self return CustomAlertPopup() if __name__ == '__main__': import src.python.defines.defines as df def func_ok(): print('OK') def func_cancel(): print('cancel') df.initRepositoryPath(__file__) app = QApplication(sys.argv) qd = createDialog() qd.setText('비밀번호가 일치하지 않습니다.')\ .setIConImage({'path':ctx.getInstance().getImagePath("alert_icon.png"),"w":62,"h":52})\ .setButtons([ {'text':'OK','listener':func_ok} ,{'text': 'cancel', 'listener': func_cancel} ,{'text': 'test', 'listener': func_cancel} ]) qd.show() sys.exit(app.exec_())