Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
citizen-stig committed Jul 20, 2014
1 parent 7488935 commit dd166ba
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 1 addition & 3 deletions pyjtt/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ def app_quit():
utils.write_config(config)
else:
app_quit()
#TODO: add check that login and password from config are correct

main_window = gui.MainWindow(jira_host, login, password)
gui.MainWindow(jira_host, login, password)
app_quit()


Expand Down
3 changes: 0 additions & 3 deletions pyjtt/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def closeEvent(self, event):
if confirmation == QtWidgets.QMessageBox.Yes:
for thread in self.worker_threads:
thread.quit()
# TODO: Add checking of online tracking
super(MainWindow, self).closeEvent(event)
else:
event.ignore()
Expand Down Expand Up @@ -311,8 +310,6 @@ def get_issue(self):
if utils.check_jira_issue_key(issue_key):
get_issue_task = partial(self.app.get_issue, issue_key)
self.tasks_queue.put(get_issue_task)
#TODO: think about it.
#self.ui.lineIssueKey.clear()

def add_worklog_entry(self):
issue = self._get_selected_issue_from_table()
Expand Down
8 changes: 7 additions & 1 deletion pyjtt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

CONFIG_FILENAME = 'pyjtt.cfg'


def get_app_working_dir():
"""Returns path to application operational folder.
Expand Down Expand Up @@ -71,12 +72,18 @@ def write_config(config):
with open(os.path.join(workdir, CONFIG_FILENAME), 'w') as configfile:
config.write(configfile)


def get_local_utc_offset(now, utcnow):
"""Calculates local UTC offset. Returns string"""
logger.debug('Getting local UTC Offset')

def absolute_offset(bigger_timestamp, smaller_timestamp):
minutes = bigger_timestamp.minute - smaller_timestamp.minute
# Case when, minutes can be differ on one minute because
# of time gap between now and utcnow. This difference cannot
# be more than one minute
if minutes == 1:
minutes = 0
hours_diff = abs(bigger_timestamp.hour - smaller_timestamp.hour)
if minutes < 0:
hours_diff -= 1
Expand All @@ -102,7 +109,6 @@ def get_timedelta_from_utc_offset(time_string):
utc_offset = time_string[-5:]
hours = int(utc_offset[0:3])
minutes = int(utc_offset[3:5])
# TODO: add bound values checking
return timedelta(hours=hours, minutes=minutes)


Expand Down
7 changes: 3 additions & 4 deletions tests/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ def test_get_local_utc_offset_simple(self):
utcnow = datetime.datetime(2013, 1, 4, 16, 35)
self.assertEqual(utils.get_local_utc_offset(now, utcnow), '-0530')
# Different minutes MSK
# TODO: Fix this
#now = datetime.datetime(2013, 1, 4, 11, 5)
#utcnow = datetime.datetime(2013, 1, 4, 7, 4)
#self.assertEqual(utils.get_local_utc_offset(now, utcnow), '+0400')
now = datetime.datetime(2013, 1, 4, 11, 5)
utcnow = datetime.datetime(2013, 1, 4, 7, 4, 59)
self.assertEqual(utils.get_local_utc_offset(now, utcnow), '+0400')

def test_get_local_utc_offset_errors(self):
# wrong year
Expand Down

0 comments on commit dd166ba

Please sign in to comment.