def _on_whoami_data(self, spawner, piston_whoami): # once we have data, make sure to save it config = get_config() config.email = piston_whoami["preferred_email"] config.reviews_username = piston_whoami["username"] # emit self.emit("whoami", piston_whoami)
def _get_recommender_uuid(self): """ returns the recommender UUID value, which can be empty if it has not yet been set (indicating that the user has not yet opted-in to the recommender service) """ config = get_config() if config.has_option("general", "recommender_uuid"): recommender_uuid = config.get("general", "recommender_uuid") if recommender_uuid: return recommender_uuid return ""
def on_transaction_started(self, backend, pkgname, appname, trans_id, trans_type): details = self.TransactionDetails(self.db, pkgname, appname, trans_id, trans_type) self.transactions_queue[pkgname] = details config = get_config() if (trans_type == TransactionTypes.INSTALL and trans_id != PURCHASE_TRANSACTION_ID and config.add_to_unity_launcher and softwarecenter.utils.is_unity_running()): if details.desktop_file is not None: self._add_application_to_unity_launcher(details)
def setUpClass(cls): # we can only have one instance of availablepane, so create it here cls.win = get_test_window_availablepane() cls.available_pane = cls.win.get_data("pane") # get the global config cls.config = get_config() # patch is_unity_running so that the test works inside a e.g. # ADT patch("softwarecenter.utils.is_unity_running").start().return_value = True patch("softwarecenter.backend.unitylauncher.UnityLauncher" "._get_launcher_dbus_iface").start().return_value = Mock()
def setUpClass(cls): # we can only have one instance of availablepane, so create it here cls.win = get_test_window_availablepane() cls.available_pane = cls.win.get_data("pane") # get the global config cls.config = get_config() # patch is_unity_running so that the test works inside a e.g. # ADT patch("softwarecenter.utils.is_unity_running").start( ).return_value = True patch("softwarecenter.backend.unitylauncher.UnityLauncher" "._get_launcher_dbus_iface").start().return_value = Mock()
def test_config_singleton(self): config1 = get_config() config2 = get_config() self.assertEqual(config1, config2)
def _on_whoami_data(self, spawner, piston_whoami): # once we have data, make sure to save it config = get_config() config.set("general", "email", piston_whoami["preferred_email"]) # emit self.emit("whoami", piston_whoami)
def __init__(self): GObject.GObject.__init__(self) self.wk = None self._wk_handlers_blocked = False self._oauth_token = None self.config = get_config()
def __init__(self): super(PurchaseView, self).__init__() self.wk = None self._wk_handlers_blocked = False self._oauth_token = None self.config = get_config()
def __init__(self, xid=None): GObject.GObject.__init__(self) self.xid = xid self.config = get_config()