def name_compare(self, _data): tmp_name = _data['name'] print(User_Notice.get_id(), tmp_name) if User_Notice.get_id() == tmp_name: if db.member_switch_state(tmp_name): print('접속 유지') pass else: print('로그아웃 시키기') db_logout.member_logout(tmp_name) ##디비종료 self.coerce_logout_signal.emit() ##로그인gui실행 self.chat_close() ##퇴장문구 self.chatting.stop() ##연결된 채팅 종료 else: self.msg_wel_bye(_data)
def login(self): id = self.id_input.text() pwd = self.pwd_input.text() info = db.member_equal(id, pwd) if info == False: #로그인 정보확인 ㅇ self.popup = Popup(self) self.popup.login_fail() self.popup.show() else: #if db.member_switch_state(id): #접속중일때 switch->0 # db_logout.member_logout(id) db.member_login(id) #(id, email 반환해줌) User_Notice.info_update(info) ##a 로그인정보 업데이트 self.login_signal.emit() self.deleteLater()
def get_msg(self, msg): #2 if len(msg) == 0: pass else: self.name = User_Notice.get_id() msg = '2:' + self.name + ':' + msg self.msg_to_client(msg)
def confirm(self): title = self.get_title() content = self.get_content() date = '0000-00-00' time = '00-00' memo_type = 0 #서버 용량검사, 메모 글자수 검사 flag = self.title_null_check(title) if flag: flag = self.text_count(content) if flag: user_name = User_Notice.get_id() memo_db.write_memo(user_name, memo_type, title, content, date, time) #아이디 해야함 ㅇㅇ 연동 ㅇㅇ #memo_widget.memo_count += 1 self.popup = Popup(self) self.popup.memo_create_complete() self.popup.show() self.popup.new_signal.connect(self.complete) else: self.popup = Popup(self) self.popup.memo_create_fail_countover() self.popup.show() else: self.popup = Popup(self) self.popup.memo_title_null() self.popup.show()
def get_msg(self, msg): #2 if len(msg) == 0: pass else: self.name = User_Notice.get_id() send_msg = {'flag': '2', 'name': self.name, 'content': msg} send_msg = json.dumps(send_msg) self.msg_to_client(send_msg)
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) self.resize(650, 520) self.setMinimumSize(QtCore.QSize(650, 520)) self.setMaximumSize(QtCore.QSize(650, 520)) self.display_frame = QtWidgets.QFrame(self) self.display_frame.setGeometry(QtCore.QRect(30, 10, 530, 440)) self.display_frame.setStyleSheet( "background-color: white;border-style: outset; border-width: 0px") self.gridLayout = QtWidgets.QGridLayout(self.display_frame) self.scrollArea = QtWidgets.QScrollArea(self.display_frame) self.scrollArea.setWidgetResizable(True) self.scrollAreaWidgetContents = QtWidgets.QWidget() self.scrollAreaWidgetContents.setGeometry( QtCore.QRect(30, 10, 530, 440)) self.verticalLayout = QtWidgets.QVBoxLayout( self.scrollAreaWidgetContents) self.user_name = User_Notice.get_id() self.memo_count = memo_db.count_memo(self.user_name) self.get_memo() frame_lists = self.create_var_memo(self.memo_count, self.memo_collect) for frame in frame_lists: self.display(frame) self.scrollArea.setWidget(self.scrollAreaWidgetContents) self.gridLayout.addWidget(self.scrollArea, 0, 1, 1, 1) self.create_Gmemo = QtWidgets.QPushButton(self) self.create_Gmemo.setGeometry(QtCore.QRect(185, 460, 80, 40)) self.create_Gmemo.setStyleSheet( "background-color: #414141; color: white;border-style: outset; border-radius: 5px; border-color: black; border-width: 1px" ) self.create_Amemo = QtWidgets.QPushButton(self) self.create_Amemo.setGeometry(QtCore.QRect(330, 460, 80, 40)) self.create_Amemo.setStyleSheet( "background-color: #414141; color: white;border-style: outset; border-radius: 5px; border-color: black; border-width: 1px" ) self.delete_memo = QtWidgets.QPushButton(self) self.delete_memo.setGeometry(QtCore.QRect(475, 460, 80, 40)) self.delete_memo.setStyleSheet( "background-color: #414141; color: white;border-style: outset; border-radius: 5px; border-color: black; border-width: 1px" ) self.create_Gmemo.clicked.connect(lambda: self.create_Gmemo_method()) self.create_Amemo.clicked.connect(lambda: self.create_Amemo_method()) self.delete_memo.clicked.connect(lambda: self.remove_memo()) self.retranslateUi(self) QtCore.QMetaObject.connectSlotsByName(self)
def closeContext(self): ###################chatting 문구, db login_switch=0 #all connect -> exit out_id=User_Notice.get_id() try: if out_id != False: self.childchat.chat_close() db.member_logout(out_id) finally: db.mysql_close() time.sleep(0.01) self.deleteLater() self.close()
def dropEvent(self, event): file_widget.prime_number = event.mimeData().text() owner = file_db.get_file_owner(file_widget.prime_number) if owner == User_Notice.get_id(): if file_db.file_check(file_widget.prime_number) != None: #a self.info_loading() self.call_rename_input() self.input_rename.new_signal.connect( self.test) #rename_input.py 완료신호오면 실행하도록 else: self.fail_error_signal.emit() #에러 else: self.fail_not_owner_signal.emit() #권한 없
def dropEvent(self, event): file_widget.prime_number = event.mimeData().text() #파일 고유번호 owner = file_db.get_file_owner(file_widget.prime_number) #파일 주인 겟 if owner == User_Notice.get_id(): #파일 주인 == 현 사용자 허가 if file_db.file_check(file_widget.prime_number) != None: #고유번호에 해당되는 파일 있어? #있엉 DB_file_path, DB_file_name = file_db.get_file_name_path(file_widget.prime_number) ftp_delete.file_delete(DB_file_name, DB_file_path) #서버 파일 삭제 file_db.delete_file(file_widget.prime_number) #디비 정보 삭제 self.delete_signal.emit() self.cancle() else: self.fail_not_exist_signal.emit() #삭제 실패 파일 없졍 else: self.fail_not_owner_signal.emit() #삭제 실패 권한 없졍
def __init__(self): super().__init__() self.timer = QtCore.QTimer() self.timer.start(1000) self.timer.timeout.connect(self.timeout) self.user_name = User_Notice.get_id()
def chat_login_connect(self): self.chatting.daemon = True self.chatting.set_name(User_Notice.get_id())
def dropEvent(self, event): data = event.mimeData() urls = data.urls() if urls and urls[0].scheme() == 'file': filepath = str(urls[0].path())[1:] print(filepath) if filepath[-4:].upper() == "HTML" or filepath[-3:].upper( ) == "WMA" or filepath[-3:].upper( ) == "MPG" or filepath[-3:].upper( ) == "GIF" or filepath[-3:].upper( ) == "CSS" or filepath[-1:].upper() == "C" or filepath[-4:].upper( ) == "JAVA" or filepath[-2:].upper( ) == "PY" or filepath[-3:].upper() == "ZIP" or filepath[-3:].upper( ) == "TXT" or filepath[-3:].upper() == "PNG" or filepath[ -3:].upper() == "JPG" or filepath[-3:].upper( ) == "HWP" or filepath[-4:].upper() == "DOCS" or filepath[ -4:].upper() == "PPTX" or filepath[-3:].upper( ) == "PDF" or filepath[-3:].upper() == "CSV": #25mb 넘으면 실패 처리 if self.size_check(filepath): user_name = User_Notice.get_id() file_name = self.get_filename(filepath) from_file_path = self.get_filepath(filepath) To_filepath = '/home/yeonwoo/' upload_time = datetime.datetime.now() file_type = self.get_filetype(file_name) server_file_name = file_db.upload_file( user_name, file_name, To_filepath, file_type) ftp_upload.file_upload(file_name, from_file_path, server_file_name) file_widget.file_count += 1 self.upload_signal.emit() self.cancle() elif self.size_check("/" + filepath): filepath = "/" + filepath user_name = User_Notice.get_id() file_name = self.get_filename(filepath) from_file_path = self.get_filepath(filepath) To_filepath = '/home/yeonwoo/' upload_time = datetime.datetime.now() file_type = self.get_filetype(file_name) server_file_name = file_db.upload_file( user_name, file_name, To_filepath, file_type) ftp_upload.file_upload(file_name, from_file_path, server_file_name) file_widget.file_count += 1 self.upload_signal.emit() self.cancle() else: self.fail_signal.emit() else: dialog = QMessageBox() dialog.setWindowTitle("에러") dialog.setText("{} 파일은 지원하지 않습니다.".format(filepath[-3:])) dialog.setIcon(QMessageBox.Warning) dialog.exec_()