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 display_update(self): self.memo_count = memo_db.count_memo(self.user_name) self.get_memo() for i in reversed(range(self.verticalLayout.count())): self.verticalLayout.itemAt(i).widget().setParent(None) frame_lists = self.create_var_memo(self.memo_count, self.memo_collect) for frame in frame_lists: self.display(frame) self.display_frame.update()
def remove_memo(self): list_radio, list_groupbox = self.find_child() for i in range(0, self.memo_count): if list_radio[i].isChecked(): for g in range(0, self.memo_count): child = list_groupbox[g].findChildren( QtWidgets.QRadioButton) if list_radio[i] == child[0]: child_button = list_groupbox[g].findChildren( QtWidgets.QPushButton) title = child_button[0].text() #삭제할 메모 제목 겟 memo_db.delete_memo(title) #DB에서도 메모 삭제 list_groupbox[g].deleteLater() #GUI 에서 메모 삭제 self.memo_count = memo_db.count_memo(self.user_name)
def remove_memo(self): self.get_memo() list_radio, list_groupbox = self.find_child() for i in range(0, self.memo_count): if list_radio[i].isChecked(): for g in range(0, self.memo_count): child = list_groupbox[g].findChildren( QtWidgets.QRadioButton) if list_radio[i] == child[0]: ########################################################################################## child_button = list_groupbox[g].findChildren( QtWidgets.QPushButton) title = child_button[0].text() #삭제할 메모 제목 겟 ########################################################################################### db_memo_time = str( memo_db.get_time( self.user_name, title)[0]) #삭제할 시간 겟 알람리스트에 있는 시간 없애야댐 if db_memo_time != '0000-00-00 00:00:00': #알람메모 처리 db_alarm_date = db_memo_time[0:10] #날짜 추출 db_alarm_time = db_memo_time[11:16] #시간 추출 self.db_time = db_alarm_date + " " + db_alarm_time #합쳐 try: alarm_list.remove( self.db_time) #재생을 위한 리스트에서 삭제해줘 #알람 삭제 except: #리스트에 없음 pass else: pass #일반메모라서 처리 안해줌 ########################################################################################### memo_db.delete_memo(self.user_name, title) #DB에서도 메모 삭제 list_groupbox[g].deleteLater() #GUI 에서 메모 삭제 self.memo_count = memo_db.count_memo(self.user_name)