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

WIP: #630: Create tests for talkeditor.py following PR #605 #631

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions src/freeseer/frontend/talkeditor/SavePromptWidget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# freeseer - vga/presentation capture software
#
# Copyright (C) 2014 Free and Open Source Software Learning Centre
# http://fosslc.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# For support, questions, suggestions or any other inquiries, visit:
# http://wiki.github.com/Freeseer/freeseer/

from PyQt4.QtGui import QDialog
from PyQt4.QtGui import QHBoxLayout
from PyQt4.QtGui import QLabel
from PyQt4.QtGui import QPushButton
from PyQt4.QtGui import QSizePolicy
from PyQt4.QtGui import QVBoxLayout


class SavePromptWidget(QDialog):
"""Dialog warning the user if there are unsaved changes to the current talk"""
def __init__(self, parent=None):
super(SavePromptWidget, self).__init__(parent)

self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

self.layout = QVBoxLayout()
self.setLayout(self.layout)

self.bottomButtonLayout = QHBoxLayout()

self.label = QLabel("The talk you were editing has unsaved changes.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be consistent with singe/double quotes. Double quotes are being used for this QLabel but single quotes for the QPushButtons below.

self.saveButton = QPushButton('Save Changes')
self.discardButton = QPushButton('Discard Changes')
self.continueButton = QPushButton('Continue Editing')

self.layout.addWidget(self.label)

self.buttonLayout = QHBoxLayout()
self.buttonLayout.addWidget(self.saveButton)
self.buttonLayout.addWidget(self.discardButton)
self.buttonLayout.addWidget(self.continueButton)

self.layout.addLayout(self.buttonLayout)

self.setWindowTitle("Unsaved Changes Exist")
28 changes: 10 additions & 18 deletions src/freeseer/frontend/talkeditor/TalkDetailsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,37 +112,29 @@ def __init__(self, parent=None):
self.layout.addWidget(self.descriptionLabel, 5, 0, 1, 1)
self.layout.addWidget(self.descriptionTextEdit, 5, 1, 1, 3)

self.fields = [self.titleLineEdit, self.presenterLineEdit, self.categoryLineEdit,
self.eventLineEdit, self.roomLineEdit, self.dateEdit, self.startTimeEdit,
self.endTimeEdit, self.descriptionTextEdit]

def toggle_input_fields(self, enable):
for field in self.fields:
field.setEnabled(enable)

def enable_input_fields(self):
self.titleLineEdit.setPlaceholderText("Enter Talk Title")
self.presenterLineEdit.setPlaceholderText("Enter Presenter Name")
self.categoryLineEdit.setPlaceholderText("Enter Category Type")
self.eventLineEdit.setPlaceholderText("Enter Event Name")
self.roomLineEdit.setPlaceholderText("Enter Room Location")
self.titleLineEdit.setEnabled(True)
self.presenterLineEdit.setEnabled(True)
self.categoryLineEdit.setEnabled(True)
self.eventLineEdit.setEnabled(True)
self.roomLineEdit.setEnabled(True)
self.dateEdit.setEnabled(True)
self.startTimeEdit.setEnabled(True)
self.endTimeEdit.setEnabled(True)
self.descriptionTextEdit.setEnabled(True)
self.toggle_input_fields(True)

def disable_input_fields(self):
self.titleLineEdit.setPlaceholderText("")
self.presenterLineEdit.setPlaceholderText("")
self.categoryLineEdit.setPlaceholderText("")
self.eventLineEdit.setPlaceholderText("")
self.roomLineEdit.setPlaceholderText("")
self.titleLineEdit.setEnabled(False)
self.presenterLineEdit.setEnabled(False)
self.categoryLineEdit.setEnabled(False)
self.eventLineEdit.setEnabled(False)
self.roomLineEdit.setEnabled(False)
self.dateEdit.setEnabled(False)
self.startTimeEdit.setEnabled(False)
self.endTimeEdit.setEnabled(False)
self.descriptionTextEdit.setEnabled(False)
self.toggle_input_fields(False)

def clear_input_fields(self):
self.titleLineEdit.clear()
Expand Down
Loading