WeatherLog: data subsets

Recently I’ve been working on my least favorite part of programming: user interface design.

These are what I have so far for the dialogs to specify criteria for selecting a subset of the data:

Select Data_002This is the simple dialog, and only allows one thing to be selected at a time.

Select Data_003This other one is the advanced dialog, and allows the user to specify from all of the criteria at once. The selection mode can be either “match all” (all criteria have to match for the data to be selected), “match at least one” (the data has to match at least one of the criteria), or “match none” (none of the criteria can fit the data). The comboboxes in the middle specify the conditions that have to be met (equal to, not equal to, less than, etc), while the entries specify the data to be compared. As shown in the screenshot, some conditions (between and outside) require multiple values, while others (equal to, not equal to) don’t require but can use them. The entries are not case sensitive.

So in the previous screenshot, the criteria will match data in which the temperature is less than 10 degrees, the precipitation type is snow,the wind speed is between 5 and 15 kph, the humidity is less than or equal to 67% and the cloud cover is anything other than sunny or partly sunny.

It’s not perfect, but it’s not bad for a start.

WeatherLog 1.9

The code clean-up went pretty well. There are still parts of the code that are less than great, but on the whole it’s much better. (And I found quite a few bugs while working on that.)

Some stats:

  • Total LOC of 1.8: 7280
  • Total LOC of 1.9: 6240
  • Total LOC removed: 1040

So I was able to remove about 14% of the code. And that doesn’t even take into account all of the changes that did not necessarily result in less code, just cleaner and clearer code.

Now that this is out of the way, I can start working on the data subsets, which I had planned for 1.9 but will now end up as 1.10.

What’s Changed?

  • Minor improvements:
    • The entire list of data is no longer refreshed when a new row is added.
    • Fixed bug where Edit wouldn’t save the data.
    • Import will now only prompt for overwrite confirmation if the current profile isn’t blank.
    • Rearranged a few menu items.
    • Fixed bug with Import as New Profile where the title would not be updated.
    • JSON files are now the default when choosing a file to import.
    • Exported JSON is no longer indented.
    • Fixed bug with Import where the title would not be updated.
    • Fixed bug where Import, Import and Merge, and Import as New Profile would not save the data.
    • Fixed bug with Add Profile where the name would have whitespace stripped after it was checked to see if the name was valid. This caused issues where it would not catch that the profile already existed.
    • Improved consistency of some dialogs.
  • Code improvements:
    • Moved launch and setup code into a new file
    • Added function to update the title, so the code to do it each time can be simplified.
    • Created file io.py for reading and writing profile files. Changes all functions that did these to use the new functions.
    • Renamed import_append() to import_merge().
    • Cleaned up lots and lots of code.
    • Merged a whole bunch of the dialog classes.

Download

Downloads can be found on the SourceForge page, and the code is available on Github.

WeatherLog 1.8

I’m going to push off working on the data subsets (which I was going to do for 1.9) and instead have the next release be all code improvements. Currently there are large parts of the code that have issues; saying that it’s less than great would be a massive understatement.

What’s Changed?

  • Major changes:
    • Added the ability to merge profiles. Currently this has to be done two at a time, though I may add the ability to do more at once later.
    • Switch Profile and Remove Profile now use listviews in the dialogs to show more than one profile at a time. They also have a second column to show the date the profiles were last modified.
    • Added the ability to copy or more data to other profiles.
  • Minor improvements:
    • Remove Profile can now delete more than one profile at a time.

Download

Downloads can be found on the SourceForge page, and the code is available on Github.

WeatherLog: what’s next

This is a list of what I have planned for future releases. (I’m mostly writing it for myself so I don’t forget to do something!)

Anything marked with COMPLETE is done, while anything marked with PARTIAL has been partially implemented. Everything else is not done yet.

  • 1.8 – Profile update
    • COMPLETE: Add the ability to merge profiles. User should be able to select a profile to merge into the current one from the same sort of dialog as Remove Profile uses. Data in the selected profile should be merged into the current one, with any dates that already exist in the current data set ignored. The selected profile will then be deleted.
    • COMPLETE: Add the ability to copy or move data from the current profile into either a new or an already existing one. User should be able to select the dates to copy/move using the same dialog as Info for Selected Dates uses. After the data has been copied/moved the profile will not be changed (stay on the one that the data was copied/moved from).
    • COMPLETE: Change the Select Profile dialog to use a listbox instead of a combobox. The current interface works, but is not very user-friendly if there are a large amounts of profiles. (Also for the previous item, use the same updated interface for selecting the existing profile to copy or move to.)
    • COMPLETE: Change the Remove Profile dialog to use the same interface as the new Select Profile dialog (listbox). Also, have this listbox allow multiple selections, to allow Remove Profile to delete multiple profiles at once.
  • 1.9 – Data subsets
    • Allow the user to select a subset of data to view, based on specified conditions. Have two dialogs for this; a simple one, that allows for specifying one condition at a time, and a more complex one, to specify multiple.
    • User should be able to select data based on the values of any field (like temperature, precipitation, etc.). They should be able to select whether data is equal to**, not equal to**, greater than, less than, greater than or equal to, less than or equal to, between*, between (inclusive)*, outside*, or outside (inclusive)* values. Conditions marked with one asterisk require two values to be input, while conditions marked with two asterisks can take one or more. Any others only take one value. Note that not all fields can use all of the conditions. All except for equal to and not equal to require numbers, which means that fields like wind direction, precipitation type, and cloud cover cannot use them.
    • Data subsets will be displayed in a separate window than the main one, with buttons at the bottom for exporting the data (as raw data (JSON), or formatted as CSV or HTML).
  • Sometime after 1.9 – Help update
    • Write a detailed help file on absolutely everything. Include detailed instructions, and screenshots and examples where applicable.
    • Organize the help page better. Have separate sections for each general topic (ex. adding/editing/removing data, importing and exporting, getting info, etc.), with subsections within them for each individual item.
    • Have a table of contents for all of this, to make finding the help sections easier (possibly write something in JS to auto-generate the table of contents from the headers?).
    • Change the CSS to something that doesn’t look so ugly.
  • Possibly 2.0? – Graphs
    • Add graphs for the info. Bar charts, trends over time, things like that.
    • Use matplotlib for displaying (it has a GTK+3 backend).
    • To avoid adding matplotlib as a dependency for the rest of the application, import it in a “try” block. If it raises an ImportError, set a variable to remember that it was not imported. Then if the user tries to view a graph, check the variable and show a dialog saying that they are unavailable.
  • Sometime not yet decided – massive code clean-up. Currently there is a ton of redundant code (especially with the dialog files), places where I’ve reimplemented something multiple times, etc. Cut out as much of that as possible.

WeatherLog 1.7.1

What’s Changed?

  • Minor improvements:
    • Moved the Info and Charts menu items into a new Info global menu. This organizes the menu UI a bit better.
    • Added Profiles -> Rename Profile.
    • Profiles -> Add Profile now strips off leading and trailing whitespace.
  • Code improvements:
    • Updated python-weather-api to 0.3.8 (from 0.3.6).

Download

Downloads can be found on the SourceForge page, and the code is available on Github.

WeatherLog 1.7

What’s Changed?

  • Major changes:
    • Added the ability the ability to select non-consecutive dates to show info/charts about. With the “Info/Charts in Range” feature the dates need to all be together. The new feature allows for selecting any dates.
  • Code improvements:
    • Further simplifications.

Download

Downloads can be found on the SourceForge page, and the code is available on Github.