Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Commit

Permalink
Refactor methods that use booleans heavily
Browse files Browse the repository at this point in the history
  • Loading branch information
benbuckley committed Nov 20, 2014
1 parent 079fdaf commit 9d96145
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions src/freeseer/frontend/talkeditor/talkeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,26 +372,42 @@ def talk_selected(self, model):
self.oldTalkIndex = QPersistentModelIndex(model)

def toggle_import(self):
if self.importTalksWidget.csvRadioButton.isChecked():
self.importTalksWidget.csvLineEdit.setEnabled(True)
self.importTalksWidget.csvFileSelectButton.setEnabled(True)
self.importTalksWidget.rssLineEdit.setEnabled(False)
else:
self.importTalksWidget.csvLineEdit.setEnabled(False)
self.importTalksWidget.csvFileSelectButton.setEnabled(False)
self.importTalksWidget.rssLineEdit.setEnabled(True)
isCheckedBool = self.importTalksWidget.csvRadioButton.isChecked()
self.importTalksWidget.csvLineEdit.setEnabled(isCheckedBool)
self.importTalksWidget.csvFileSelectButton.setEnabled(isCheckedBool)
self.importTalksWidget.rssLineEdit.setEnabled(not isCheckedBool)
#if self.importTalksWidget.csvRadioButton.isChecked():
# self.importTalksWidget.csvLineEdit.setEnabled(True)
# self.importTalksWidget.csvFileSelectButton.setEnabled(True)
# self.importTalksWidget.rssLineEdit.setEnabled(False)
#else:
# self.importTalksWidget.csvLineEdit.setEnabled(False)
# self.importTalksWidget.csvFileSelectButton.setEnabled(False)
# self.importTalksWidget.rssLineEdit.setEnabled(True)

def toggle_import_talks_widget(self, show):
self.commandButtons.setHidden(show)
self.tableView.setHidden(show)
self.talkDetailsWidget.setHidden(show)
self.importTalksWidget.setHidden(not show)

def show_import_talks_widget(self):
self.commandButtons.setHidden(True)
self.tableView.setHidden(True)
self.talkDetailsWidget.setHidden(True)
self.importTalksWidget.setHidden(False)
self.toggle_import_talks_widget(True)

#def show_import_talks_widget(self):
# self.commandButtons.setHidden(True)
# self.tableView.setHidden(True)
# self.talkDetailsWidget.setHidden(True)
# self.importTalksWidget.setHidden(False)

def hide_import_talks_widget(self):
self.commandButtons.setHidden(False)
self.tableView.setHidden(False)
self.talkDetailsWidget.setHidden(False)
self.importTalksWidget.setHidden(True)
self.toggle_import_talks_widget(False)

#def hide_import_talks_widget(self):
# self.commandButtons.setHidden(False)
# self.tableView.setHidden(False)
# self.talkDetailsWidget.setHidden(False)
# self.importTalksWidget.setHidden(True)

def add_talk(self):
"""Adds a new talk to the database using data from the NewTalkWidget input fields"""
Expand Down

0 comments on commit 9d96145

Please sign in to comment.