Esempio n. 1
0
 def testSaveLoad(self):
     prefs = Preferences('prefstest.conf')
     
     self.assertEqual(None, prefs.btDevice)
     self.assertEqual('bluetooth', prefs.connectionMethod)
     self.assertEqual('', prefs.customDevice)
     self.assertEqual(0, prefs.gammuIndex)
     
     prefs.btDevice = BluetoothDevice('00:00:00:00', 42, 'deviceName', 'serviceName')
     prefs.connectionMethod = 'connection'
     prefs.customDevice = '/dev/rfcomm0'
     prefs.gammuIndex = 2
             
     prefs.save()
     
     prefsLoaded = Preferences('prefstest.conf')
     prefsLoaded.load()
     
     self.assertNotEqual(None, prefsLoaded.btDevice, "Device has not been loaded")
     self.assertEqual('00:00:00:00', prefsLoaded.btDevice.address)
     self.assertEqual(42, prefsLoaded.btDevice.port)
     self.assertEqual('deviceName', prefsLoaded.btDevice.deviceName)
     self.assertEqual('serviceName', prefsLoaded.btDevice.serviceName)
     self.assertEqual('connection', prefsLoaded.connectionMethod)
     self.assertEqual('/dev/rfcomm0', prefsLoaded.customDevice)
     self.assertEqual(2, prefsLoaded.gammuIndex)
Esempio n. 2
0
 def __init__(self):
     # These 3 are need
     GObject.threads_init()
     DBusGMainLoop(set_as_default=True)
     Gst.init(None)
     
     self.sound_menu = SoundMenuControls('anoise')
     self.noise = Noise()
     self.win_preferences = Preferences(self)
     
     # Need in a few DE
     try:
         self.window = GUI(self)
     except:
         pass
     
     self.player = Gst.ElementFactory.make(PLAYBIN, "player")
     self.player.connect("about-to-finish", self._loop)
     
     self.player.set_property('uri', self.noise.get_current_filename())
     self.is_playing = True
     
     dummy_i18n = (_("Coffee Shop"), _("Fire"), _("Forest"), _("Night"), _("Rain"), _("River"), _("Sea"), _("Storm"), _("Wind")) # Need i18n
     
     # Overwrite libraty methods
     self.sound_menu._sound_menu_is_playing = self._sound_menu_is_playing
     self.sound_menu._sound_menu_play       = self._sound_menu_play
     self.sound_menu._sound_menu_pause      = self._sound_menu_pause
     self.sound_menu._sound_menu_next       = self._sound_menu_next
     self.sound_menu._sound_menu_previous   = self._sound_menu_previous
     self.sound_menu._sound_menu_raise      = self._sound_menu_raise
     
     # Autostart when click on sound indicator icon
     threading.Timer(2, self._sound_menu_play).start()
Esempio n. 3
0
 def __init__(self):
     self.amqp_thread = None
     self.gladefile = "conillet.glade"  # store the file name
     self.builder = Gtk.Builder()  # create an instance of the gtk.Builder
     #self.builder.add_from_file(self.gladefile) # add the xml file to the Builder
     self.builder.add_objects_from_file(self.gladefile, [
         "window1", "aboutdialog1", "statusbar1", "status", "log_result",
         "entry1", "entry2", "result1", "logwindow", "image1", "image2",
         "image3", "image4", "connection_toggle_button",
         "connection_status_image", "message_view"
     ])
     self.builder.connect_signals(self)
     self.window = self.builder.get_object(
         "window1")  # This gets the 'window1' object
     self.aboutdialog = self.builder.get_object("aboutdialog1")
     self.log_window = self.builder.get_object("logwindow")
     self.statusbar = self.builder.get_object("statusbar1")
     self.context_id = self.statusbar.get_context_id("status")
     self.connection_toggle_button = self.builder.get_object(
         "connection_toggle_button")
     self.connection_status_image = self.builder.get_object(
         "connection_status_image")
     self.logger_label = self.builder.get_object("log_result")
     self.message_view = self.builder.get_object("message_view")
     self.logger = MyLogger(self.logger_label)
     self.preferences = Preferences(self.builder, self.logger)
     self.rabbit_params = RabbitParams(self.preferences.get_values())
     self.rabbit_connection = RabbitConnection(
         self.rabbit_params, self.logger, self.connection_toggle_button,
         self.message_view)
     self.logger.warning("Inici aplicacio")
     self.window.show()  # this shows the 'window1' object
     self.status_count = 0
Esempio n. 4
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setWindowIcon(QIcon(":/icons/apps/16/tabulator.svg"))

        self._recentDocuments = []
        self._actionRecentDocuments = []
        self._keyboardShortcutsDialog = None

        self._preferences = Preferences()
        self._preferences.loadSettings()

        self._createActions()
        self._createMenus()
        self._createToolBars()

        self._loadSettings()

        self._updateActions()
        self._updateActionFullScreen()
        self._updateMenuOpenRecent()

        # Central widget
        self._documentArea = QMdiArea()
        self._documentArea.setViewMode(QMdiArea.TabbedView)
        self._documentArea.setTabsMovable(True)
        self._documentArea.setTabsClosable(True)
        self.setCentralWidget(self._documentArea)
        self._documentArea.subWindowActivated.connect(self._onDocumentWindowActivated)
Esempio n. 5
0
    def __save_preferences(self):
        # get selected buttons.
        bus = self.PrefB.get()
        spo = self.PrefSp.get()
        apple = self.PrefA.get()
        usa = self.PrefU.get()
        bbc = self.PrefBbc.get()
        bitcoin = self.PrefBtcoin.get()
        pref = []
        if bus:
            pref.append(bus)
        if spo:
            pref.append(spo)
        if apple:
            pref.append(apple)
        if usa:
            pref.append(usa)
        if bbc:
            pref.append(bbc)
        if bitcoin:
            pref.append(bitcoin)

        # make comma separated list from that.
        pref_str = ",".join(pref)
        pref = Preferences(pref_str)

        database_utils.save_preferences(pref)
        self.quit()
Esempio n. 6
0
    def __init__(self):
        self.current = 0
        self.buffers = []
        self.config = config
        gui = GUI()
        state['gui'] = gui
        self.preferences = Preferences()
        try:
            self.recent_manager = gtk.recent_manager_get_default()
        except AttributeError:
            self.recent_manager = None
        self.status = gui.status
        self.revision_status = gui.revision_status
        self.window = gui.window
        self.window.add_accel_group(make_accel_group(self))
        self.textbox = gui.textbox
        self.UNNAMED_FILENAME = FILE_UNNAMED

        self.autosave_timeout_id = ''
        self.autosave_elapsed = ''

        self.textbox.connect('key-press-event', self.key_press_event)

        # Autosave timer object
        autosave.start_autosave(self)

        self.window.show_all()
        self.window.fullscreen()

        # Handle multiple monitors
        screen = gtk.gdk.screen_get_default()
        root_window = screen.get_root_window()
        mouse_x, mouse_y, mouse_mods = root_window.get_pointer()
        current_monitor_number = screen.get_monitor_at_point(mouse_x, mouse_y)
        monitor_geometry = screen.get_monitor_geometry(current_monitor_number)
        self.window.move(monitor_geometry.x, monitor_geometry.y)

        # Defines the glade file functions for use on closing a buffer or exit
        gladefile = os.path.join(state['absolute_path'], "interface.glade")
        builder = gtk.Builder()
        builder.add_from_file(gladefile)
        self.dialog = builder.get_object("SaveBuffer")
        self.dialog.set_transient_for(self.window)
        self.quitdialog = builder.get_object("QuitSave")
        self.quitdialog.set_transient_for(self.window)
        dic = {
            "on_button-close_clicked": self.unsave_dialog,
            "on_button-cancel_clicked": self.cancel_dialog,
            "on_button-save_clicked": self.save_dialog,
            "on_button-close2_clicked": self.quit_quit,
            "on_button-cancel2_clicked": self.cancel_quit,
            "on_button-save2_clicked": self.save_quit,
        }
        builder.connect_signals(dic)

        self.keybindings = define_keybindings(self)
        # this sucks, shouldn't have to call this here, textbox should
        # have its background and padding color from GUI().__init__() already
        gui.apply_theme()
Esempio n. 7
0
    def __init__(self):
        pygame.init()

        #get preferences
        self.preferences = Preferences()

        #resolution, flags, depth, display
        self.unit = Constants.RESOLUTION[0] / Constants.UNITS
        self.banner = Banner()
        self.score_width = self.unit * 15

        if self.preferences.fullscreen:
            self.screen = pygame.display.set_mode((Constants.RESOLUTION[0]+self.score_width,\
                                               Constants.RESOLUTION[1]),pygame.FULLSCREEN)
        else:
            self.screen = pygame.display.set_mode((Constants.RESOLUTION[0]+self.score_width,\
                                               Constants.RESOLUTION[1]),0,32)

        pygame.display.set_caption(Constants.CAPTION)

        #game area surface
        self.gamescreen = pygame.Surface(Constants.RESOLUTION)
        #score area rectangle surface
        self.scorescreen = pygame.Surface(
            (self.score_width, Constants.RESOLUTION[1]))

        #Snake and foods manager
        self.me=Snake(color=pygame.color.THECOLORS[self.preferences.get("color")],\
                     nickname=self.preferences.get("nickname"))

        self.nickname = self.preferences.get("nickname")
        self.f = Foods()

        #Score manager
        self.scores = Scores((self.score_width, Constants.RESOLUTION[1]))

        #add our own score, the server will send us the remaining one at connection
        self.scores.new_score(self.preferences.get("nickname"),\
                        pygame.color.THECOLORS[self.preferences.get("color")])

        #game area background color
        self.gamescreen.fill(Constants.COLOR_BG)
        self.scorescreen.fill((100, 100, 100))

        #timers
        self.clock = pygame.time.Clock()
        self.current_time = 0

        self.move_snake_timer = Timer(1.0 / Constants.SNAKE_SPEED * 1000,
                                      self.current_time,
                                      periodic=True)
        self.blink_snake_timer = Timer(1.0 / Constants.SNAKE_BLINKING_SPEED *
                                       1000,
                                       self.current_time,
                                       periodic=True)
        self.blink_banner_timer = Timer(500, self.current_time, periodic=True)
        self.new_apple_timer = Timer(Constants.NEW_APPLE_PERIOD * 1000,
                                     self.current_time,
                                     periodic=True)
Esempio n. 8
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.setAttribute(Qt.WA_DeleteOnClose)

        self._preferences = Preferences()
        self._canonicalName = None
        self._canonicalIndex = 0
Esempio n. 9
0
 def initialize_mixed(self):
     P = Preferences(defaults={
         "x1": 1,
         "x2": 2
     },
                     filename=self.filename,
                     x3=3)
     return P
Esempio n. 10
0
 def __init__(self, user_id, order_list, leverage=3):
     self.preferences = Preferences()
     self.account_balance = 100
     self.account_sentiment = 0
     self.user_id = user_id
     self.connection = ClientServer(order_list)
     self.execution_delay = True
     self.max_sentiment = leverage
Esempio n. 11
0
def get_preferences():
    conn = sqlite3.connect('newsapp.db')
    cur = conn.cursor()
    cur.execute('SELECT * from NewsPreference')
    p_row = cur.fetchone()
    p = Preferences(p_row[0])
    conn.close()
    return p
Esempio n. 12
0
    def get_preferences(self) -> Preferences:
        """Returns user's preferences saved in database or,
		if there is none, default preferences."""
        query = self._session.query(Preferences)
        try:
            return query.all()[0]
        except IndexError:
            return Preferences()
Esempio n. 13
0
 def show_preferences(self, widget):
     widget.set_sensitive(False)
     preferences = Preferences()
     response = preferences.run()
     if response == Gtk.ResponseType.ACCEPT:
         preferences.save()
         self.load_preferences()
         self.set_icon(self.is_monitoring)
     preferences.destroy()
     widget.set_sensitive(True)
Esempio n. 14
0
    def on_preferences_activated(self, event=None):
        """Raises the preferences dialog. If it's already open, it's
        focused"""
        if self._preferences_dialog is not None:
            self._preferences_dialog.present()
            return

        self._preferences_dialog = Preferences(self)
        self._preferences_dialog.run()
        self._preferences_dialog = None
Esempio n. 15
0
    def initialize_with_relative_path(self):

        relative_path = os.path.join(RELATIVE_FOLDER, self.filename)
        absolute_path = os.path.join(CURRENT_PATH, RELATIVE_FOLDER)
        self.assertTrue(
            os.path.exists(absolute_path)
        )  # if this fails, that means that this test would fail anyway, because I haven't directed it to an existing folder

        P = Preferences(defaults=self.defaults_with_dict,
                        filename=relative_path)
        return P
Esempio n. 16
0
    def __init__(self):
        self.preferences = Preferences()

        self.w = vanilla.Window((150, 50), 'Equalize Sidebearings')
        self.w.activation_key_label = vanilla.TextBox((10, 15, -10, 22),
                                                      'Short Key:')
        self.w.activation_key = vanilla.EditText(
            posSize=(82, 12, -10, 25),
            text=self.preferences.activation_key,
            callback=self.edit_text_callback)
        self.w.open()
Esempio n. 17
0
    def __init__(self, photolist, photoframe):

        self.gui = Gtk.Builder()
        self.gui.add_from_file(
            os.path.join(constants.SHARED_DATA_DIR, 'menu.ui'))

        self.photoimage = photoframe.photoimage
        self.photolist = photolist

        self.preferences = Preferences(photolist)
        self.about = AboutDialog()

        self.is_show = False
Esempio n. 18
0
 def show_preferences(self, widget):
     widget.set_sensitive(False)
     preferences = Preferences()
     Keybinder.unbind(self.new_task_keybind)
     Keybinder.unbind(self.show_tasks_keybind)
     response = preferences.run()
     if response == Gtk.ResponseType.ACCEPT:
         preferences.save()
         self.load_preferences()
         self.load_todos()
         self.set_icon()
     widget.set_sensitive(True)
     preferences.destroy()
Esempio n. 19
0
    def __init__(self, player):
        self.player = player
        self.win_preferences = Preferences(self)

        builder = Gtk.Builder()
        builder.add_from_file('/usr/share/anoise/anoise.ui')
        self.win_icon = builder.get_object('icon_noise')
        self.btn_play = builder.get_object('btn_play')
        self.lbl_title = builder.get_object('lbl_title')
        builder.connect_signals(self)
        self.window = builder.get_object('main_win')
        self.window.show_all()
        self._set_window_icon()
Esempio n. 20
0
    def __init__(self):
        super(App, self).__init__("HipStatus")
        self.icon = _menu_bar_icon(0)
        self.preferences = Preferences()
        self._validate_preferences()

        self.keychain = Keychain(self.preferences.email())
        self._validate_keychain()

        self.hipchat = HipChat(self.keychain.read_token())
        self.office365 = Office365(self.preferences.email(),
                                   self.keychain.read_o365())

        self.menu_pause_button = rumps.MenuItem("Pause HipStatus",
                                                self.timer_pause)
        self.menu_preferences = rumps.MenuItem('Preferences...')

        self.menu = [
            self.menu_pause_button, rumps.separator, self.menu_preferences,
            rumps.separator
        ]

        self.menu_preferences_message = rumps.MenuItem(
            "", self.preferences_message)
        if self.preferences.default_message():
            self.menu_preferences_message.title = self.preferences.default_message(
            )
        else:
            self.menu_preferences_message.title = "None..."

        self.menu_preferences_email = rumps.MenuItem(
            "Change email address", self.preferences_update_email)
        self.menu_preferences_o365 = rumps.MenuItem(
            "Update saved Office 365 password", self.preferences_update_o365)
        self.menu_preferences_token = rumps.MenuItem(
            "Update saved HipChat token", self.preferences_update_token)
        self.menu_preferences_get_token = rumps.MenuItem(
            "Get your HipChat token", open_browser)

        self.menu_preferences.add(rumps.MenuItem('Status message...'))
        self.menu_preferences.add(self.menu_preferences_message)
        self.menu_preferences.add(rumps.separator)
        self.menu_preferences.add(rumps.MenuItem('Preferences...'))
        self.menu_preferences.add(self.menu_preferences_email)
        self.menu_preferences.add(self.menu_preferences_o365)
        self.menu_preferences.add(self.menu_preferences_token)
        self.menu_preferences.add(rumps.separator)
        self.menu_preferences.add(self.menu_preferences_get_token)

        self.main_timer = rumps.Timer(self.timer_trigger, 300)
        self.main_timer.start()
Esempio n. 21
0
    def __init__(self):
        # These 3 are needed
        GObject.threads_init()
        DBusGMainLoop(set_as_default=True)
        Gst.init(None)
        GLib.set_application_name(_('Ambient Noise'))
        self.sound_menu = SoundMenuControls('Ambient Noise', 'anoise')
        self.noise = Noise()
        self.win_preferences = Preferences(self)

        try:
            self.keybinder = Keybinder
            self.keybinder.init()
            if self.keybinder.bind('AudioPlay', self._sound_menu_play_toggle,
                                   None):
                self.keybinder.bind('AudioStop', self._sound_menu_stop, None)
                self.keybinder.bind('AudioPause', self._sound_menu_pause, None)
                self.keybinder.bind('AudioNext', self._sound_menu_next, None)
                self.keybinder.bind('AudioPrev', self._sound_menu_previous,
                                    None)
            else:
                self.keybinder = None

        except (ValueError, ImportError):
            self.keybinder = None

        # Need in a few DE
        try:
            self.window = GUI(self)
        except:
            pass

        self.player = Gst.ElementFactory.make(PLAYBIN, "player")
        self.player.connect("about-to-finish", self._loop)

        dummy_i18n = (_("Coffee Shop"), _("Fire"), _("Forest"), _("Night"),
                      _("Rain"), _("River"), _("Sea"), _("Storm"), _("Wind")
                      )  # Need i18n

        # Overwrite libraty methods
        self.sound_menu._sound_menu_is_playing = self._sound_menu_is_playing
        self.sound_menu._sound_menu_play = self._sound_menu_play
        self.sound_menu._sound_menu_pause = self._sound_menu_pause
        self.sound_menu._sound_menu_next = self._sound_menu_next
        self.sound_menu._sound_menu_previous = self._sound_menu_previous
        self.sound_menu._sound_menu_raise = self._sound_menu_raise
        self.sound_menu._sound_menu_play_toggle = self._sound_menu_play_toggle

        # Autostart when click on sound indicator icon
        threading.Timer(1, self._sound_menu_play).start()
Esempio n. 22
0
    def __init__(self, parent=None):
        ui.MainBaseUI.__init__(self, parent)
        self.ui = ui.MainUI()
        self.ui.setupUi(self)

        self.settings = QtCore.QSettings(QtCore.QSettings.IniFormat,
                                         QtCore.QSettings.UserScope, "fxihub",
                                         "spts")

        self.preferences = Preferences(self)

        self.view = View(self)
        self.ui.horizontalLayout.addWidget(self.view)

        self.ui.dataTypeTabWidget.setCurrentIndex(0)

        self.clear_cache()

        self.conf = Conf(self)
        self.i_frame = 0
        self.data_type = "1_raw"
        self._create_worker(silent=True)

        self.options = Options(self)
        self.options.load_all()
        self.options.connect_all()

        self.view_options = ViewOptions(self)
        self.view_options.connect_all()

        self.ui.actionOpen.triggered.connect(self.conf.open)
        self.ui.actionSave.triggered.connect(self.conf.save)
        self.ui.actionSaveAs.triggered.connect(self.conf.save_as)
        self.ui.actionPreferences.triggered.connect(
            self.preferences.open_preferences_dialog)
        self.ui.dataTypeTabWidget.currentChanged.connect(self._on_tab_changed)

        self.ui.previousPushButton.clicked.connect(self._show_previous)
        self.ui.nextPushButton.clicked.connect(self._show_next)
        self.ui.iFrameSpinBox.valueChanged.connect(self._on_i_frame_changed)

        #from IPython.terminal.debugger import set_trace
        #set_trace()
        pgDown = QtGui.QShortcut(QtGui.QKeySequence('PgDown'), self)
        pgDown.activated.connect(self._show_next)
        pgUp = QtGui.QShortcut(QtGui.QKeySequence('PgUp'), self)
        pgUp.activated.connect(self._show_previous)

        self._show_frame()
Esempio n. 23
0
    def __init__(self):
        '''self.config = {}
        if mntdir is None:
            self.config['VIDEO_PATH'] = os.path.join(self.APP_PATH, 'videos')
            self.config['SNAPSHOT_PATH'] = os.path.join(self.APP_PATH, 'snapshot')
        else:
            self.config['VIDEO_PATH'] = os.path.join(mntdir, 'videos')
            self.config['SNAPSHOT_PATH'] = os.path.join(mntdir, 'snapshot')

        self.config['SNAPSHOT_PREFIX'] = 'sshot_'
        self.config['Motion'] = True
        self.config['Timeout'] = 30 * 60'''

        # self.pb = Pushbullet(PB_API_KEY)
        self.pref = Preferences(self)
        self._setupUI()
Esempio n. 24
0
class HackernewsExtension(Extension):

    _preferences = Preferences()
    _screens = Screens()
    _hn = HN()
    _cache = Cache()

    def __init__(self):
        super(HackernewsExtension, self).__init__()

        # Subscribe to events
        self.subscribe(KeywordQueryEvent, KeywordQueryEventListener())
        self.subscribe(
            PreferencesEvent,
            PreferencesEventListener())  # Set preferences to inner members
        self.subscribe(PreferencesUpdateEvent,
                       PreferencesUpdateEventListener())
        self.subscribe(ItemEnterEvent, ItemEnterEventListener())

    def show_top_stories(self, load_page_number):

        # Check if the page is cached
        cached_page = self._cache.get_page(load_page_number)

        if cached_page:
            return RenderResultListAction(cached_page)
        else:
            stories = self._hn.load_top_stories(load_page_number)
            items = self._screens.render_top_stories(stories[0],
                                                     load_page_number)

            # Cache first item
            self._cache.add_page(load_page_number, items)

            # Cache items
            for i in range(1, len(stories)):
                page_number = load_page_number + i
                current_items = self._screens.render_top_stories(
                    stories[i], page_number)
                self._cache.add_page(page_number, current_items)

        return RenderResultListAction(items)

    def show_open_confirmation(self, number_of_links):
        confirmation = self._screens.render_open_confirmation(number_of_links)
        return RenderResultListAction(confirmation)
Esempio n. 25
0
    def __init__(self, path="../database"):

        self.session_files = []

        self.books = self.getBooks(path)

        self.preferences = Preferences()
        self.preferences.readConfig()
        self.session = copy.deepcopy(self.preferences)

        self.db = Database()
        self.openDefaultDatabase()

        self.presenter = Presenter()

        self.songs = []
        self.uploaded_song = {}
Esempio n. 26
0
    def show_preferences(self, widget):
        widget.set_sensitive(False)
        preferences_dialog = Preferences()
        response = preferences_dialog.run()
        if response == Gtk.ResponseType.ACCEPT:
            preferences_dialog.save()
            configuration = Configuration()
            preferences = configuration.get('preferences')
            self.theme_light = preferences['theme-light']
            self.application_name = preferences['application_name']

            if self.gotify_client is not None and \
                    self.gotify_client.is_running():
                self.stop()
                self.start()
        preferences_dialog.destroy()
        widget.set_sensitive(True)
Esempio n. 27
0
    def OnInit(self):

        import Inspectors, Layouts, Shapes  # pylint: disable=W0612

        neuroptikon.library = Library()
        self._loadDefaultLibraryItems()

        neuroptikon.config = wx.Config('Neuroptikon')

        if platform.system() == 'Darwin':
            wx.MenuBar.MacSetCommonMenuBar(self.menuBar())

        neuroptikon.scriptLocals = self.scriptLocals

        self.preferences = Preferences()
        self.inspector = InspectorFrame()

        self.SetExitOnFrameDelete(False)

        startupScript = neuroptikon.config.Read('Startup Script', '')
        try:
            exec startupScript in self.scriptLocals()
        except:
            (exceptionType, exceptionValue,
             exceptionTraceback) = sys.exc_info()
            frames = traceback.extract_tb(exceptionTraceback)[1:]
            message = gettext(
                'An error occurred while running the startup script:')
            subMessage = str(
                exceptionValue
            ) + ' (' + exceptionType.__name__ + ')' + '\n\nTraceback:\n' + ''.join(
                traceback.format_list(frames))
            if platform.system() == 'Darwin':
                wx.MessageBox(subMessage, message, style=wx.ICON_ERROR | wx.OK)
            else:
                wx.MessageBox(message + '\n\n' + subMessage,
                              'Neuroptikon',
                              parent=self,
                              style=wx.ICON_ERROR | wx.OK)

        # open an empty network by default
        # TODO: pref to re-open last doc?
        self.onNewNetwork()

        return True
Esempio n. 28
0
    def __init__(self, config_path):
        self._logger = getLogger("raspberry")
        self._logger.setLevel(INFO)
        formatter = Formatter(
            '%(asctime)s [%(name)s] %(levelname)s : %(message)s')
        stream_handler = StreamHandler()
        stream_handler.setLevel(INFO)
        stream_handler.setFormatter(formatter)
        self._logger.addHandler(stream_handler)
        signal.signal(signal.SIGINT, self.exit_gracefully)
        signal.signal(signal.SIGTERM, self.exit_gracefully)

        self._logger.info("Initializing...")
        self.preference_checker = Preferences(config_path)
        self.video_player = VideoPlayer()
        self.tv_controller = TVController()

        self._logger.info("Ready")
Esempio n. 29
0
    def __init__(self, *args):

        QApplication.__init__(self, *args)

        # initialize logging
        logging.basicConfig(filename='log.txt',
                            level=logging.INFO,
                            filemode='w',
                            format='%(asctime)s %(message)s')
        logging.info("Starting application.")

        # initialize user preferences
        preferences = Preferences()

        # initialize model
        market = GoxMarket(preferences)

        # initialize view
        self.view = View(preferences, market)

        self.connect(self, SIGNAL('lastWindowClosed()'), self.__quit)
Esempio n. 30
0
    def retranslateUi(self, MainWindow):
        self.preferences = Preferences("settings_default.yaml")
        self.file_in_line.setText(self.preferences.file_in)
        self.file_in_line.textChanged.connect(self.update_preferences)
        self.file_out_line.setText(self.preferences.file_in.replace(".csv", "_clean.csv"))
        self.file_out_line.textChanged.connect(self.update_preferences)
        self.password_line.textChanged.connect(self.update_preferences)
        self.schema_line.textChanged.connect(self.update_preferences)
        self.table_line.textChanged.connect(self.update_preferences)

        MainWindow.setWindowTitle(_translate("MainWindow", "THE DATA DUMPER!!!", None))
        self.dumper = DataDumper()
        self.actionDjango_Model.triggered.connect(self.press_django)
        self.actionPostgreSQL.triggered.connect(self.press_postgres)
        self.actionSettings.triggered.connect(self.show_settings)
        self.label.setText(_translate("MainWindow", "File Input", None))
        self.open_file_button.setText(_translate("MainWindow", "Open File", None))
        self.open_file_button.clicked.connect(self.selectFile)
        self.label_10.setText(_translate("MainWindow", "File Output", None))
        self.label_2.setText(_translate("MainWindow", "Schema", None))
        self.label_3.setText(_translate("MainWindow", "Table", None))
        self.label_7.setText(_translate("MainWindow", "Password", None))
        self.auto_read_checkbox.setText(_translate("MainWindow", "Create a mapping if it does not exist.", None))
        self.label_8.setText(_translate("MainWindow", "If there is an error, it will appear here.", None))
        self.sanitize_button.setText(_translate("MainWindow", "Sanitize .csv", None))
        self.sanitize_button.clicked.connect(self.press_sanitize)
        self.read_button.setText(_translate("MainWindow", "Map .csv / Overwrite Current Mapping", None))
        self.read_button.clicked.connect(self.press_csv_map)
        self.menuFile.setTitle(_translate("MainWindow", "File", None))
        self.menuExport.setTitle(_translate("MainWindow", "Export", None))
        self.actionSet_Defaults.setText(_translate("MainWindow", "Defaults", None))
        self.actionSave_current_preferences.setText(_translate("MainWindow", "Save Preferences", None))
        self.actionLoad_Preferences.setText(_translate("MainWindow", "Load Preferences", None))
        self.actionPreferences.setText(_translate("MainWindow", "Preferences", None))
        self.actionSanitization.setText(_translate("MainWindow", "Sanitization", None))
        self.actionPostgreSQL.setText(_translate("MainWindow", "PostgreSQL", None))
        self.actionDjango_Model.setText(_translate("MainWindow", "Django Model", None))
        self.actionSettings.setText(_translate("MainWindow", "Settings", None))