myweatherindicator.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:my-weather-indicator 作者: atareao 项目源码 文件源码
def __init__(self):
        GObject.Object.__init__(self)
        if dbus.SessionBus().request_name('es.atareao.MyWeatherIndicator') !=\
                dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER:
            print("application already running")
            exit(0)
        #
        self.weather_updater = 0
        self.widgets_updater = 0
        self.internet_updater = 0
        self.internet_connection = False
        self.menus = []
        self.indicators = []
        self.notifications = []
        self.widgets = []
        self.weatherservices = []
        self.weathers = []
        self.current_conditions = []
        self.preferences = []
        self.last_update_time = 0
        # Iniciate variables
        for i in range(INDICATORS):
            self.menus.append(None)
            self.indicators.append(None)
            self.notifications.append(None)
            self.widgets.append(None)
            self.weatherservices.append(None)
            self.weathers.append(None)
            self.current_conditions.append(None)
            self.preferences.append(None)
        #
        status = appindicator.IndicatorCategory.APPLICATION_STATUS
        self.notifications[0] = Notify.Notification.new('', '', None)
        self.indicators[0] = appindicator.Indicator.new(
            'My-Weather-Indicator', 'My-Weather-Indicator', status)
        self.notifications[1] = Notify.Notification.new('', '', None)
        self.indicators[1] = appindicator.Indicator.new(
            'My-Weather-Indicator2', 'My-Weather-Indicator', status)
        for i in range(INDICATORS):
            self.create_menu(i)
        for i in range(INDICATORS):
            self.widgets[i] = None
        self.load_preferences()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号