import itertools
import warnings
+import gobject
import gtk
import gtk.glade
self._messagesViews = None
self._recentViews = None
self._contactsViews = None
+ self._tabHoldTimeoutId = None
for path in self._glade_files:
if os.path.isfile(path):
callbackMapping = {
"on_paste": self._on_paste,
- "on_refresh": self._on_refresh,
+ "on_refresh": self._on_menu_refresh,
"on_clearcookies_clicked": self._on_clearcookies_clicked,
"on_notebook_switch_page": self._on_notebook_switch_page,
"on_about_activate": self._on_about_activate,
}
self._widgetTree.signal_autoconnect(callbackMapping)
+ self._notebook.connect("button-press-event", self._on_tab_press)
+ self._notebook.connect("button-release-event", self._on_tab_release)
self._initDone = True
for attemptCount in xrange(numOfAttempts):
if loggedIn:
break
- availableServices = {
- self.GV_BACKEND: "Google Voice",
- self.GC_BACKEND: "Grand Central",
- }
+ availableServices = (
+ (self.GV_BACKEND, "Google Voice"),
+ (self.GC_BACKEND, "Grand Central"),
+ )
with gtk_toolbox.gtk_lock():
credentials = self._credentialsDialog.request_credentials_from(
availableServices, defaultCredentials = self._credentials
with open(self._user_settings, "wb") as configFile:
config.write(configFile)
+ def _refresh_active_tab(self):
+ page_num = self._notebook.get_current_page()
+ if page_num == self.CONTACTS_TAB:
+ self._contactsViews[self._selectedBackendId].update(force=True)
+ elif page_num == self.RECENT_TAB:
+ self._recentViews[self._selectedBackendId].update(force=True)
+ elif page_num == self.MESSAGES_TAB:
+ self._messagesViews[self._selectedBackendId].update(force=True)
+
def _on_close(self, *args, **kwds):
try:
if self._osso is not None:
elif page_num == self.ACCOUNT_TAB:
self._accountViews[self._selectedBackendId].update()
+ def _on_tab_press(self, *args):
+ self._tabHoldTimeoutId = gobject.timeout_add(1000, self._on_tab_refresh)
+
+ def _on_tab_release(self, *args):
+ if self._tabHoldTimeoutId is not None:
+ gobject.source_remove(self._tabHoldTimeoutId)
+ self._tabHoldTimeoutId = None
+
+ def _on_tab_refresh(self, *args):
+ self._tabHoldTimeoutId = None
+ self._refresh_active_tab()
+ return False
+
def _on_sms_clicked(self, number, message):
assert number
assert message
self._errorDisplay.push_exception(e)
def _on_dial_clicked(self, number):
- assert number
+ assert number, "No number to call"
try:
loggedIn = self._phoneBackends[self._selectedBackendId].is_authed()
except StandardError, e:
dialed = False
try:
- assert self._phoneBackends[self._selectedBackendId].get_callback_number() != ""
+ assert self._phoneBackends[self._selectedBackendId].get_callback_number() != "", "No callback number specified"
self._phoneBackends[self._selectedBackendId].dial(number)
dialed = True
except StandardError, e:
if dialed:
self._dialpads[self._selectedBackendId].clear()
- def _on_refresh(self, *args):
- page_num = self._notebook.get_current_page()
- if page_num == self.CONTACTS_TAB:
- self._contactsViews[self._selectedBackendId].update(force=True)
- elif page_num == self.RECENT_TAB:
- self._recentViews[self._selectedBackendId].update(force=True)
- elif page_num == self.MESSAGES_TAB:
- self._messagesViews[self._selectedBackendId].update(force=True)
+ def _on_menu_refresh(self, *args):
+ self._refresh_active_tab()
def _on_paste(self, *args):
contents = self._clipboard.wait_for_text()
def open_addressbook(self, bookId):
name, ext = bookId.rsplit(".", 1)
- assert ext in self.FILETYPE_SUPPORT
+ assert ext in self.FILETYPE_SUPPORT, "Unsupported file extension %s" % ext
return self.FILETYPE_SUPPORT[ext](bookId)
@staticmethod
"""
@note Actual dial function is patched in later
"""
- raise NotImplementedError
+ raise NotImplementedError("Horrible unknown error has occurred")
def get_number(self):
return self._phonenumber
self._defaultCallback = ""
def enable(self):
- assert self._backend.is_authed()
+ assert self._backend.is_authed(), "Attempting to enable backend while not logged in"
self._accountViewNumberDisplay.set_use_markup(True)
self.set_account_number("")
self._callbackList.clear()
)
def enable(self):
- assert self._backend.is_authed()
+ assert self._backend.is_authed(), "Attempting to enable backend while not logged in"
self._recentview.set_model(self._recentmodel)
self._recentview.append_column(self._dateColumn)
"""
@note Actual dial function is patched in later
"""
- raise NotImplementedError
+ raise NotImplementedError("Horrible unknown error has occurred")
def update(self, force = False):
if not force and self._isPopulated:
pass
def _idly_populate_recentview(self):
- self._isPopulated = True
self._recentmodel.clear()
+ self._isPopulated = True
try:
recentItems = self._backend.get_recent()
)
if action == PhoneTypeSelector.ACTION_CANCEL:
return
- assert phoneNumber
+ assert phoneNumber, "A lack of phone number exists"
self.number_selected(action, phoneNumber, message)
self._recentviewselection.unselect_all()
)
def enable(self):
- assert self._backend.is_authed()
+ assert self._backend.is_authed(), "Attempting to enable backend while not logged in"
self._messageview.set_model(self._messagemodel)
self._messageview.append_column(self._dateColumn)
"""
@note Actual dial function is patched in later
"""
- raise NotImplementedError
+ raise NotImplementedError("Horrible unknown error has occurred")
def update(self, force = False):
if not force and self._isPopulated:
pass
def _idly_populate_messageview(self):
- self._isPopulated = True
self._messagemodel.clear()
+ self._isPopulated = True
try:
messageItems = self._backend.get_messages()
)
if action == PhoneTypeSelector.ACTION_CANCEL:
return
- assert phoneNumber
+ assert phoneNumber, "A lock of phone number exists"
self.number_selected(action, phoneNumber, message)
self._messageviewselection.unselect_all()
)
def enable(self):
- assert self._backend.is_authed()
+ assert self._backend.is_authed(), "Attempting to enable backend while not logged in"
self._contactsview.set_model(self._contactsmodel)
self._contactsview.append_column(self._contactColumn)
"""
@note Actual dial function is patched in later
"""
- raise NotImplementedError
+ raise NotImplementedError("Horrible unknown error has occurred")
def get_addressbooks(self):
"""
pass
def _idly_populate_contactsview(self):
- self._isPopulated = True
self.clear()
+ self._isPopulated = True
# completely disable updating the treeview while we populate the data
self._contactsview.freeze_child_notify()
)
if action == PhoneTypeSelector.ACTION_CANCEL:
return
- assert phoneNumber
+ assert phoneNumber, "A lack of phone number exists"
self.number_selected(action, phoneNumber, message)
self._contactsviewselection.unselect_all()
parentWindow = self._parentWindow
self._serviceList.clear()
- for serviceIdserviceName in services.iteritems():
+ for serviceIdserviceName in services:
self._serviceList.append(serviceIdserviceName)
self._serviceCombo.set_active(0)
self._serviceCombo.show()
__build__ = 0
__changelog__ = '''
1.0.3
+* Holding down a tab for a second will now force a refresh
+* Fixed a bug dealing with overzealously refreshing the contacts tab
+* Finding some undescriptive errors and made them more descriptive
+* Swapped the order GrandCentral and GoogleVoice appear in login window
1.0.2
* Random bug fixes