Thursday, February 27, 2014

Week8 Blog4

Progress I made
  • Changed the countdown display to show in the format hh:mm:ss (AutoRecordWidget.py) 
  • Completed the countdown display. Now both the time until the start of recording and the time remaining until end of recording show up on the screen (record.py)
  • Added code for starting and stopping the auto-recording, in the case where user doesn't manually exit auto-recording (record.py). I spent a veeeeeeery long time debugging this part. The timer for the countdown display and the timer for the wait time before the start of the recording are different. For the wait timer, at first I tried to use QThread's wait(). Then I tried Python time module's sleep(). But this puts the whole Freeseer program to sleep(), including the countdown display. So then I switched to using two QTimer objects, one for waiting until the start of a recording, and the other for waiting until the end of a recording. But somehow the interaction between these two timers messes up the code. So I tried to use just one timer for both countdown. Theoretically it should work, since the two countdowns don't overlap. However, even though I stopped and reset the timer where I think is appropriate, after starting the recording, the timeout signal causes one method to be called repeatedly before the recording stops, thus starting the recording a second time, a third time, a fourth time,..., before it ever stops. In the end, I switched to using QTimer's static function singleShot(). This way, there is no timer instances, and thus no resetting problems. and FINALLY IT WORKED!!! YAY!!! \o/

Plans for next week
  • Right before the start of recording, countdown shows 00:00:01 instead of 00:00:00. Need to fix it 
  • Make the countdown display more readable: change the font, size, and position of the text and countdown
  • Implement the following cases for stop auto-recording: 
  • case 1: user doesn't manually exit auto-recording, but there are no more talks to record. We need to exit the auto-record screen after the last talk 
  • case 2: auto-recording isn't finished, but user decides to quit by pressing the "Stop auto-record". Then we need to exit and screen and stop recording right away
  • If no talk satisfies the room and time condition for auto-recording in the first place, show message dialog box that informs the user of this
 Problems
None.


Wednesday, February 19, 2014

Week7 Blog3

Progress I made
  • Fixed last week's blog problem #1, where the auto-record button appeared in the "Record" interface when not necessary
  •  Added method to get talk id from database using current date, time, and room (database.py). This is used for auto-record mode.
  •  Since I have no prior knowledge of PyQt4, I researched about how to use QTime to make a countdown, how to display countdown, as well as how to display messages that change over time. At first, QLCDNumber seems like a nice fit to the countdown I'm trying to implement, since it conveniently displays LCD numbers like a digital clock. However, we also need to display text about the next talk and hint strings like "Time remaining". So in the end, I decided to use a layout instead.  See the bottom of the blog for a list of useful tutorials. 
  • Wrote the beginning of auto_record(), where if you press auto-record, it'll show fullscreen countdown until the next talk starts recording (record.py)  
  • Wrote the widget for display info about talk and time remaining (AutoRecordWidget.py)
  • Added Esc key to exit fullscreen (AutoRecordWidget.py)
Note: auto-record should record talks starting at or after the current computer time, in the room that is currently displayed in the room field of the recording UI. If there are no talks that qualify this condition, for the code right now, nothing happens.

Plans for next week
  • Auto mode display: add code for displaying time remaining info during recording (record.py)
  • Recording: add code for start recording and stop recording, while there are still talks to record and we are still in auto mode (record.py)
  • Recording UI: pressing Esc in countdown window will exit fullscreen, not stop the auto-recording. If user clicks the X, then countdown window will close, but not stop recording. At this time, everything in the main recording UI should be disabled except the auto-record button. This button should show "Stop auto-record", and if user clicks on that, then auto-record should stop (record.py)
  • Right now the countdown only shows minutes and seconds. Need to also show the hours (AutoRecordWidget.py)
Problems
None.

Tutorials

Countdown timer:
  • http://stackoverflow.com/questions/12661211/cant-seem-to-get-pyqt-countdown-timer-to-work
  • http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?index=396&key=QTimerCountdown
Useful PyQt4 code snippets, in particular Full Screen
  • http://thewikiblog.appspot.com/wiki/be-productive-with-pyqt4
Widgets and layouts
  • http://www.pythoncentral.io/pyside-pyqt-tutorial-interactive-widgets-and-layout-containers/
QSqlQuery
  • http://srinikom.github.io/pyside-docs/PySide/QtSql/QSqlQuery.html#PySide.QtSql.PySide.QtSql.QSqlQuery.value

Thursday, February 13, 2014

Week5-6 Blog2

In this post, I will combine the week just before the code sprint together with this week.

Progress I made:

1. Fixed issue #453, where the date in the recording editor displays incorrectly. The problem was in database.py, when we are filtering dates using "Date(time)" instead of just "Date".
2. In order for automated recording to work, we need to store the start time as well as the end time of a talk. Thus I added the new end time field in the talk editor, report editor, etc., and updated the database to include such a change. As a reminder to myself, here is a list of files I changed:
  • ---framework
    #database.py
    #presentation.py
  • frontend
    ---talkeditor
    #AddTalkWidget.py
    #TalkDetailsWidget.py
    #talkeditor.py
  • --reporteditor
    #ReportEditorWidget.py
    reporteditor.py
  • ---record
    #record.py
    #ReportDialog.py
3. Updated the already existing unit tests so that they still pass with the newly added end time.
4. Added the auto-recording button to the main recording interface (with no functionality yet).

Plans for next week:

1. Right now the auto-record button not only appears in the "Prepare to record" interface, but also in the "Record" interface. I need to fix it so that it only appears in the main talk editor UI.
2. Research how to implement full screen as the display screen during auto-recording, and how to display constantly changing messages on screen.
3. Extract the next talk’s information from the database. Using the starting time and the computer’s current time, display the time until the next talk. Display details about the talk below the time. Repeat this process for every talk until the user presses the exit key, or until there are no more talks to record in the database.
4. Add a shortcut key that allows the editor to exit from full screen mode.

Problems:

1. Currently, rss and csv don't have end time, which means, either the auto-recording feature is not available for rss imports, or when the user tries to use auto-recording, a dialog pops up, asking the user to manually enter the end time.

Notes:

The code sprint last weekend was really helpful for me in figuring out the code base, and it was a pleasure to meet all of the mentors and students! I also learned a lot of things from the code sprint. Special thanks to Dennis, who always answered my questions with patience. =)
Here are some of the things I learned, as a reminder to myself:

To run Freeseer master branch (the origin):
1. make sure you committed your changes before proceeding
2. git checkout master
3. git pull upstream master
4. python -m freeseer

To switch back to your topic branch:
1. git checkout your-topic-branch

To split a fix into its own branch and open a new pull request:
1. git checkout master
2. git pull upstream master (make sure you are up to date with master branch)
3. git checkout -b new-topic-branch-name
4. git log (to see the ID of the commit you want to split)
5. git cherry-pick commit-ID (e.g.711bd3a4f8f9cb7a28da1522c1d5a6fb304424da)
6. if it says "fix conflicts", then run git diff
7. fix the conflicts by deleting the stuff you don't need
8. git add .
7. git cherry-pick --continue
8. to edit the commit message, run git commit --amend
9. to see what you changed in a particular commit, run git show commmit-ID (the first few characters of the ID is fine, as long as it's unique enough)
10. make sure those are the commits you want to push
11. git push origin topic-branch-name

VERY IMPORTANT:
Run the unit tests and flake8 before pushing changes up to github! Here is a how-to link:
https://groups.google.com/forum/#!searchin/freeseer/flake8/freeseer/HdY-IVur0w8/JgPiK6usrSAJ