def __init__(self, view):
        Signals.__init__(self)

        view.set_data(constants.DOCUMENT_HELPER_KEY, self)

        self._view = view
        self._buffer = None
        self._in_mode = False
        self._column_mode = None

        self._edit_points = []
        self._multi_edited = False
        self._status = None
        self._status_timeout = 0
        self._delete_mode_id = 0

        self.connect_signal(self._view, 'notify::buffer',
                            self.on_notify_buffer)
        self.connect_signal(self._view, 'key-press-event',
                            self.on_key_press_event)
        self.connect_signal(self._view, 'expose-event',
                            self.on_view_expose_event)
        self.connect_signal(self._view, 'style-set', self.on_view_style_set)
        self.connect_signal(self._view, 'undo', self.on_view_undo)
        self.connect_signal(self._view, 'copy-clipboard',
                            self.on_copy_clipboard)
        self.connect_signal(self._view, 'cut-clipboard', self.on_cut_clipboard)
        self.connect_signal(self._view, 'query-tooltip', self.on_query_tooltip)

        self._view.props.has_tooltip = True

        self.reset_buffer(self._view.get_buffer())

        self.initialize_event_handlers()
Пример #2
0
    def __init__(self, plugin, window):
        Signals.__init__(self)

        self._window = window
        self._plugin = plugin
        self._views = {}

        # Insert menu items
        self._insert_menu()

        # Insert document helpers
        for view in window.get_views():
            self.add_document_helper(view)

        self.connect_signal(window, 'tab-added', self.on_tab_added)
        self.connect_signal(window, 'tab-removed', self.on_tab_removed)

        self._accel_group = gtk.AccelGroup()
        self._window.add_accel_group(self._accel_group)

        self._proxy_callback_map = {
            'IncreaseFontSizeAction': self.on_increase_font_accel,
            'DecreaseFontSizeAction': self.on_decrease_font_accel,
            'ResetFontSizeAction': self.on_reset_font_accel
        }

        self._proxy_mapping = {}
        self._init_proxy_accels()
        self._accel_map_handler_id = gtk.accel_map_get().connect(
            'changed', self.on_accel_map_changed)
Пример #3
0
    def __init__(self, view):
        Signals.__init__(self)

        view.set_data(constants.DOCUMENT_HELPER_KEY, self)

        self._view = view
        self._buffer = None
        self._in_mode = False
        self._column_mode = None

        self._edit_points = []
        self._multi_edited = False
        self._status = None
        self._status_timeout = 0
        self._delete_mode_id = 0

        self.connect_signal(self._view, 'notify::buffer', self.on_notify_buffer)
        self.connect_signal(self._view, 'key-press-event', self.on_key_press_event)
        self.connect_signal(self._view, 'expose-event', self.on_view_expose_event)
        self.connect_signal(self._view, 'style-set', self.on_view_style_set)
        self.connect_signal(self._view, 'undo', self.on_view_undo)
        self.connect_signal(self._view, 'copy-clipboard', self.on_copy_clipboard)
        self.connect_signal(self._view, 'cut-clipboard', self.on_cut_clipboard)
        self.connect_signal(self._view, 'query-tooltip', self.on_query_tooltip)
        
        self._view.props.has_tooltip = True

        self.reset_buffer(self._view.get_buffer())

        self.initialize_event_handlers()
Пример #4
0
def player_fire(data):
    game_id = int(data['game_id'])
    user_id = int(data['user_id'])
    enemy_id = (user_id + 1) % 2
    coord_x = int(data['coord']['x'])
    coord_y = int(data['coord']['y'])
    try:
        game = ROOMS[game_id]

        if game.running and not game.finished:
            hitted, killed, error = game.fire(coord_x, coord_y, user_id)

            if error:
                emit('error', Signals(521, game=game).__str__(), room=game_id)
                game.error = False
            else:
                emit("fired", {
                    'game_id': game_id,
                    'enemy_id': enemy_id,
                    'next_player_id': game.current_player,
                    'is_hit': hitted,
                    'coord': {
                        'x': coord_x,
                        'y': coord_y
                    },
                    'is_ship': killed
                },
                     room=game_id)

                if game.finished:
                    emit("game-finished", game.statistics(), room=game_id)
        else:
            emit("error", Signals(522, game=game).__str__())
    except KeyError:
        emit('error', Signals(519, id=game_id).__str__())
    def get_signals(self):
        signals = Signals(self.sample_rate, self.order_appliances,
                          breakpoint_classification_my_data, self.improved,
                          "temperature_mydata.csv")
        signals.set_signals_mydata(self.appliances)

        return signals
Пример #6
0
    def __init__(self, plugin, window):
        Signals.__init__(self)

        self._window = window
        self._plugin = plugin
        self._views  = {}

        # Insert menu items
        self._insert_menu()

        # Insert document helpers
        for view in window.get_views():
            self.add_document_helper(view)

        self.connect_signal(window, 'tab-added', self.on_tab_added)
        self.connect_signal(window, 'tab-removed', self.on_tab_removed)

        self._accel_group = gtk.AccelGroup()
        self._window.add_accel_group(self._accel_group)

        self._proxy_callback_map = {
            'IncreaseFontSizeAction': self.on_increase_font_accel,
            'DecreaseFontSizeAction': self.on_decrease_font_accel,
            'ResetFontSizeAction': self.on_reset_font_accel
        }

        self._proxy_mapping = {}
        self._init_proxy_accels()
        self._accel_map_handler_id = gtk.accel_map_get().connect('changed', self.on_accel_map_changed)
Пример #7
0
 def initialize_threads(self):
     """ Initializes io threads"""
     super().initialize_threads()
     self.dashboard_interval = int(self.ping_interval * 2)
     self.topic_fastclock_pub = self.publish_topics[Global.FASTCLOCK]
     self.topic_dashboard_pub = self.publish_topics[Global.DASHBOARD]
     self.topic_node_pub = self.publish_topics[Global.NODE]
     self.topic_ping_sub = self.subscribed_topics[Global.PING]
     # print("!!! ping sub: "+self.topic_ping_sub)
     self.topic_sensor_sub = self.subscribed_topics[Global.SENSOR]
     self.topic_backup_sub = self.subscribed_topics[Global.BACKUP]
     # print("!!! backup sub: "+self.topic_backup_sub)
     if Global.CONFIG in self.config:
         if Global.OPTIONS in self.config[Global.CONFIG]:
             if Global.TIME in self.config[Global.CONFIG][Global.OPTIONS]:
                 if Global.FAST in self.config[Global.CONFIG][
                         Global.OPTIONS][Global.TIME]:
                     if Global.RATIO in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_ratio = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.RATIO])
                     if Global.INTERVAL in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_interval = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.INTERVAL])
             if Global.PING in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.ping_interval = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.PING]
             if Global.BACKUP in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.backup_path = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.BACKUP]
     self.roster = Roster(self.log_queue,
                          file_path=Global.DATA + "/" + Global.ROSTER +
                          ".json")
     self.switches = Switches(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.SWITCHES + ".json")
     self.warrants = Warrants(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.WARRANTS + ".json")
     self.signals = Signals(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SIGNALS +
                            ".json")
     self.layout = Layout(self.log_queue,
                          file_path=Global.DATA + "/" + Global.LAYOUT +
                          ".json")
     self.dashboard = Dashboard(self.log_queue,
                                file_path=Global.DATA + "/" +
                                Global.DASHBOARD + ".json")
     self.sensors = Sensors(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SENSORS +
                            ".json")
Пример #8
0
    def __init__(self, view):
        Signals.__init__(self)

        self._view = view

        self.connect_signal(self._view, 'scroll-event', self.on_scroll_event)
        self.connect_signal(self._view, 'button-press-event', self.on_button_press_event)

        self._view.textsize_document_helper = self

        self._default_font = None
        self._last_font = None
        self._font_tags = {}
Пример #9
0
    def __init__(self, view):
        Signals.__init__(self)

        self._view = view

        self.connect_signal(self._view, 'scroll-event', self.on_scroll_event)
        self.connect_signal(self._view, 'button-press-event', self.on_button_press_event)

        self._view.set_data(constants.DOCUMENT_HELPER_KEY, self)

        self._default_font = None
        self._last_font = None
        self._font_tags = {}
Пример #10
0
    def __init__(self, plugin, window):
        Signals.__init__(self)

        self._window = window
        self._plugin = plugin

        # Insert document helpers
        for view in window.get_views():
            self.add_document_helper(view)

        self.connect_signal(window, 'tab-added', self.on_tab_added)
        self.connect_signal(window, 'tab-removed', self.on_tab_removed)

        self.install_ui()
Пример #11
0
 def __init__(self, plugin, window):
     Signals.__init__(self)
     
     self._window = window
     self._plugin = plugin
     
     # Insert document helpers
     for view in window.get_views():
         self.add_document_helper(view)
     
     self.connect_signal(window, 'tab-added', self.on_tab_added)
     self.connect_signal(window, 'tab-removed', self.on_tab_removed)
     
     self.install_ui()
Пример #12
0
    def __init__(self, view):
        Signals.__init__(self)

        self._view = view

        self.connect_signal(self._view, 'scroll-event', self.on_scroll_event)
        self.connect_signal(self._view, 'button-press-event',
                            self.on_button_press_event)

        self._view.set_data(constants.DOCUMENT_HELPER_KEY, self)

        self._default_font = None
        self._last_font = None
        self._font_tags = {}
Пример #13
0
    def __init__(self, view):
        Signals.__init__(self)

        view.multiedit_document_helper = self

        self._view = view
        self._buffer = None
        self._in_mode = False
        self._column_mode = None
        self._move_cursor = None
        self._previous_move_cursor = None

        self._edit_points = []
        self._multi_edited = False
        self._status = None
        self._status_timeout = 0
        self._delete_mode_id = 0

        self.connect_signal(self._view, 'notify::buffer',
                            self.on_notify_buffer)
        self.connect_signal(self._view, 'key-press-event',
                            self.on_key_press_event)
        self.connect_signal(self._view, 'draw', self.on_view_draw)
        self.connect_signal(self._view, 'style-set', self.on_view_style_set)
        self.connect_signal(self._view, 'undo', self.on_view_undo)
        self.connect_signal(self._view, 'copy-clipboard',
                            self.on_copy_clipboard)
        self.connect_signal(self._view, 'cut-clipboard', self.on_cut_clipboard)
        self.connect_signal(self._view, 'paste-clipboard',
                            self.on_paste_clipboard)
        self.connect_signal(self._view, 'query-tooltip', self.on_query_tooltip)

        self.connect_signal(self._view, 'move-cursor', self.on_move_cursor)
        self.connect_signal_after(self._view, 'move-cursor',
                                  self.on_move_cursor_after)

        try:
            self.connect_signal(self._view, 'smart-home-end',
                                self.on_smart_home_end)
        except:
            pass

        self._view.props.has_tooltip = True

        self.reset_buffer(self._view.get_buffer())

        self.initialize_event_handlers()
        self.toggle_callback = None
Пример #14
0
 def __init__(self):
     super().__init__()
     self.signals = Signals()
     self.initUI()
     self.setSignals()
     self.decensor = Decensor(self)
     self.load_model()
Пример #15
0
def setting_ships_up(data):
    game_id = int(data['game_id'])
    player_id = int(data['user_id'])
    # print("Ships has been planted", data)

    try:
        game = ROOMS[game_id]
        print(data)
        game.ustanovka(user_id=data['user_id'], ships=data['ships'])
        if player_id == 0:
            game.setted_1 = True
        elif player_id == 1:
            game.setted_2 = True
        if game.setted_1 and game.setted_2:
            print("The game id=", game_id, " starts")
            game.running = True
            socketio.emit("game-started", {
                "game_id": game_id,
                "next_player_id": 0
            },
                          room=game_id)

    except KeyError:
        print("No game with such id")
        emit('error', Signals(519, id=game_id).__str__())
Пример #16
0
def create_game(data):
    game_id = len(ROOMS)
    game = Game(game_id, data['name'])
    ROOMS[game_id] = game
    join_room(game_id)

    emit('created', Signals(219, game=game, name=data['name']).__str__())
Пример #17
0
        def __init__(self):
                GObject.Object.__init__(self)
                Signals.__init__(self)

                self.placeholders = []
                self.active_snippets = []
                self.active_placeholder = None

                self.ordered_placeholders = []
                self.update_placeholders = []
                self.jump_placeholders = []
                self.language_id = 0
                self.timeout_update_id = 0

                self.provider = completion.Provider(_('Snippets'), self.language_id, self.on_proposal_activated)
                self.defaults_provider = completion.Defaults(self.on_default_activated)
Пример #18
0
 def __init__(self):
     super().__init__()
     self.signals = Signals()
     self.initUI()
     self.setSignals()
     self.decensor = Decensor(self)
     self.current_is_mosaic = None
Пример #19
0
 def __init__(self):
     self.I_Mem = Memory()
     self.D_Mem = Memory()
     self.RF = RegisterFile()
     self.RegPC = Register()
     self.signals = Signals()
     self.cycle_num = 0
     self.mode = 0
Пример #20
0
    def load_house(self, house: int):
        print("loading house: " + str(house))
        selection = self.appliance_selection[house]
        window_start, window_end = self.window_selection[house]
        self.dataset.set_window(start=window_start, end=window_end)
        elec = self.dataset.buildings[house].elec

        train_appliances = dr.load_appliances_selection(
            elec, self.order_appliances, selection, self.sample_rate)
        train_total = dr.load_total_power_consumption(elec, selection,
                                                      self.sample_rate)
        signals = Signals(self.sample_rate, self.order_appliances,
                          breakpoint_classification, self.improved,
                          "temperature_redd.csv")
        signals.set_signals(train_appliances, train_total)

        return signals
Пример #21
0
def player_fire(data):
    game_id = int(data['game_id'])
    user_id = int(data['user_id'])
    # if user_id == 1, then enemy_id == (1+1)%2 == 0
    enemy_id = (user_id + 1) % 2
    print(data)
    coord_x = int(data['coord']['x'])
    coord_y = int(data['coord']['y'])
    print(coord_x, coord_y)
    try:
        game = ROOMS[game_id]

        if game.running and not game.finished:
            hitted, killed, error = game.fire(coord_x, coord_y, user_id)

            game.printfield()
            if error:
                print("Game ", game_id, "error")
                emit('error', Signals(521, game=game).__str__(), room=game_id)
                game.error = False
            else:

                emit("fired", {
                    'game_id': game_id,
                    'enemy_id': enemy_id,
                    'next_player_id': game.current_player,
                    'is_hit': hitted,
                    'coord': {
                        'x': coord_x,
                        'y': coord_y
                    },
                    'is_ship': killed
                },
                     room=game_id)

                if game.finished:
                    print("the game is finished, winner is ", game.winner)

                    print(game.statistics())
                    emit("game-finished", game.statistics(), room=game_id)
        else:
            print("WTF MAN, game id=", game_id, " is not active")
            print(Signals(522, game=game).__str__())
            emit("error", Signals(522, game=game).__str__())
    except KeyError:
        emit('error', Signals(519, id=game_id).__str__())
Пример #22
0
    def __init__(self):
        GObject.Object.__init__(self)
        Signals.__init__(self)

        self.placeholders = []
        self.active_snippets = []
        self.active_placeholder = None

        self.ordered_placeholders = []
        self.update_placeholders = []
        self.jump_placeholders = []
        self.language_id = 0
        self.timeout_update_id = 0

        self.provider = completion.Provider(_('Snippets'), self.language_id,
                                            self.on_proposal_activated)
        self.defaults_provider = completion.Defaults(self.on_default_activated)
Пример #23
0
def join_game(data):
    game_id = int(data['game_id'])
    try:
        game = ROOMS[game_id]
        answer = game.join_user2(data['name'])

        if answer:
            join_room(game_id)

            emit('joined', Signals(221, game=game).__str__(), room=game_id)
        else:
            some_users_list = []
            for x in game.players:
                some_users_list.append(x.get_name())
            emit('error', Signals(520, game=game).__str__())
    except KeyError:
        emit("error", Signals(519, id=game_id).__str__())
Пример #24
0
    def __init__(self, game_events_window):
        self.bullet_flag = True
        self.game_events = game_events_window

        self.signal = Signals()
        self.draw_player()
        self.init_bullet()
        self.init_bullets_thread()
        self.init_thread_on_shoot()
Пример #25
0
    def __init__(self, view):
        Signals.__init__(self)

        view.multiedit_document_helper = self

        self._view = view
        self._buffer = None
        self._in_mode = False
        self._column_mode = None
        self._move_cursor = None
        self._previous_move_cursor = None

        self._edit_points = []
        self._multi_edited = False
        self._status = None
        self._status_timeout = 0
        self._delete_mode_id = 0

        self.connect_signal(self._view, 'notify::buffer', self.on_notify_buffer)
        self.connect_signal(self._view, 'key-press-event', self.on_key_press_event)
        self.connect_signal(self._view, 'draw', self.on_view_draw)
        self.connect_signal(self._view, 'style-set', self.on_view_style_set)
        self.connect_signal(self._view, 'undo', self.on_view_undo)
        self.connect_signal(self._view, 'copy-clipboard', self.on_copy_clipboard)
        self.connect_signal(self._view, 'cut-clipboard', self.on_cut_clipboard)
        self.connect_signal(self._view, 'paste-clipboard', self.on_paste_clipboard)
        self.connect_signal(self._view, 'query-tooltip', self.on_query_tooltip)

        self.connect_signal(self._view, 'move-cursor', self.on_move_cursor)
        self.connect_signal_after(self._view, 'move-cursor', self.on_move_cursor_after)

        try:
            self.connect_signal(self._view, 'smart-home-end', self.on_smart_home_end)
        except:
            pass

        self._view.props.has_tooltip = True

        self.reset_buffer(self._view.get_buffer())

        self.initialize_event_handlers()
        self.toggle_callback = None
Пример #26
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.setAttribute(Qt.WA_AlwaysStackOnTop)
     self.signals = Signals()
     self.context = Context(self.signals)
     self.setupUi(self)
     self.create_views_and_dialogs()
     self.setup_window_tabs()
     self.createMenuBarActions()
     self.connect_buttons()
     self.connect_signals()
Пример #27
0
def stop_game(data):
    alive_user_id = data['user_id']
    game_id = data['game_id']
    game = ROOMS[game_id]
    if not game.finished:
        game.finished = True
        game.winner = alive_user_id
        emit("game-extra-finished",
             Signals(249, game=game, id=alive_user_id).__str__(),
             room=game_id)
        leave_room(game_id)
        close_room(game_id)
Пример #28
0
def disconnected():
    if len(rooms()) > 1:
        game_id = -1
        for x in rooms():
            try:
                x += 1
                game_id = x - 1
            except TypeError:
                pass
        game = ROOMS[game_id]
        if not game.finished:
            socketio.emit("pinger", Signals(245).__str__(), room=game_id)
Пример #29
0
 def setSignals(self):
     self.signals = Signals()
     # set signal variable name same as method name preventing confusion
     self.signals.total_ProgressBar_update_MAX_VALUE.connect(
         self.total_ProgressBar_update_MAX_VALUE)
     self.signals.total_ProgressBar_update_VALUE.connect(
         self.total_ProgressBar_update_VALUE)
     self.signals.signal_ProgressBar_update_MAX_VALUE.connect(
         self.signal_ProgressBar_update_MAX_VALUE)
     self.signals.signal_ProgressBar_update_VALUE.connect(
         self.signal_ProgressBar_update_VALUE)
     self.signals.update_progress_LABEL.connect(self.update_progress_LABEL)
Пример #30
0
def join_game(data):
    game_id = int(data['game_id'])
    try:
        game = ROOMS[game_id]
        answer = game.join_user2(data['name'])

        if answer:
            print("Yes, gamer ", data['name'], " has joined")
            join_room(game_id)
            print(rooms())

            emit('joined', Signals(221, game=game).__str__(), room=game_id)
        else:
            print("Nope, gamer ", data['name'], " cannot join this game")
            some_users_list = []
            for x in game.players:
                some_users_list.append(x.get_name())
            print("The answer to my dear friend is: forbidden, ",
                  Signals(520, game=game).__str__())
            emit('error', Signals(520, game=game).__str__())
    except KeyError:
        print("The game with id=", game_id, " doesn't exist")
        emit("error", Signals(519, id=game_id).__str__())
Пример #31
0
def stop_game(data):
    alive_user_id = data['user_id']
    disconnected_man = data['enemy_id']
    game_id = data['game_id']
    game = ROOMS[game_id]
    if not game.finished:
        print("Game id=", game_id, " has been stopped due to player ",
              disconnected_man, " disconnected")
        game.finished = True
        game.winner = alive_user_id
        emit("game-extra-finished",
             Signals(249, game=game, id=alive_user_id).__str__(),
             room=game_id)
        leave_room(game_id)
        close_room(game_id)
Пример #32
0
    def __init__(self, editor):
        self.editor = editor

        self.signals = Signals()
        self.triggers = TriggerManager(editor)
        connect_all(self, self.signals, self.triggers, textbuffer=self.editor.textbuffer)

        self.block_word_reset = False
        self.words = None
        self.start_word = None
        self.start_offset = None
        
        self.indexer = IndexerProcessManager(self.signals.sender, editor)
        self.dictionary_manager = DictionaryManager(self.signals.sender, editor)
        self.communicator = ProcessCommunicator(self.signals.sender, editor)
        self.extractor = TextExtractor(self.signals.sender, editor)
        self.buffer_monitor = BufferMonitor(self.signals.sender, editor)
Пример #33
0
    def __init__(self, parent=None, args=None, macros=None):
        super(JetTracking, self).__init__(parent=parent,
                                          args=args,
                                          macros=macros)

        # reference to PyDMApplication - this line is what makes it so that you
        # #can avoid having to define main() and instead pydm handles that
        # for you - it is a subclass of QWidget
        self.app = QApplication.instance()
        # load data from file
        self.load_data()

        self.signals = Signals()
        self.vreader = ValueReader(self.signals)
        self.worker = StatusThread(self.signals)
        self.buffer_size = 300
        self.correction_thread = None
        # assemble widgets
        self.setup_ui()
Пример #34
0
def setting_ships_up(data):
    game_id = int(data['game_id'])
    player_id = int(data['user_id'])

    try:
        game = ROOMS[game_id]
        game.ustanovka(user_id=data['user_id'], ships=data['ships'])
        if player_id == 0:
            game.setted_1 = True
        elif player_id == 1:
            game.setted_2 = True
        if game.setted_1 and game.setted_2:
            game.running = True
            socketio.emit("game-started", {
                "game_id": game_id,
                "next_player_id": 0
            },
                          room=game_id)

    except KeyError:
        emit('error', Signals(519, id=game_id).__str__())
Пример #35
0
    def __init__(self,
                 signal: Signals,
                 clf: MLPClassifier,
                 order_appliances: [],
                 sample_period: int,
                 improved: bool,
                 breakpoints=None,
                 labels=None):
        rcParams['figure.figsize'] = (13, 6)
        r.seed(30)
        self.signal = signal
        self.sample_period = sample_period
        self.order_appliances = order_appliances
        self.improved = improved
        self.multi_appliance_label = len(order_appliances) + 1
        self.clf = clf

        if breakpoints is None:
            self.input_sl = signal.get_input_sl()
            if labels is None:
                self.labels = signal.get_labels()
            else:
                self.labels = labels
            self.states_on_breakpoints = signal.get_states_on_breakpoints()
        else:
            self.input_sl = signal.get_input_sl_custom(breakpoints)
            if labels is None:
                self.labels = signal.get_labels_custom(breakpoints)
            else:
                self.labels = labels
            self.states_on_breakpoints = signal.get_states_on_breakpoints_custom(
                breakpoints)

        self.states_consumption = np.zeros(
            (len(self.input_sl), len(order_appliances) + 2, 4))
        for i in range(0, len(self.input_sl)):
            label = self.labels[i]
            inp = self.input_sl[i]
            self.states_consumption[i][0][0] = 1
            self.states_consumption[i][label][0] = 1
            self.states_consumption[i][label][1] = inp[0]  # average
            self.states_consumption[i][label][2] = inp[1]  # min
            if improved:
                self.states_consumption[i][label][3] = inp[2]  # std
Пример #36
0
                MEM.set_data(value)
                # may use int_to_signed_32(value)
                MEM.run()
                # print ("Mem[%s]=%s"% ( hex(address),hex(value)))
                #need to set the value in memory module
    MEM.set_memwrite(0)
    return


if __name__ == '__main__':
    test = 'sig'
    "Test " + test
    if (test == 'print'):
        print_signal("B", 1, 1)
        print_signal("R", 31, 5)
        print_signal("Immd", 0xFABC, 16)
        print_signal("PC", 0x040000C4, 32)
        print_signal("RV", -1, 32)
        print_int("NoNL", -1)
        println_int("WithNL", -2)
    elif (test == 'load'):
        from hardware import Memory
        I_Mem = Memory()
        load_file(I_Mem, "input.txt")
        I_Mem.dump()
    elif (test == 'sig'):
        from signals import Signals
        sig = Signals()
        print_signals_1(sig)
        print_signals_2(sig)
Пример #37
0
        def __init__(self):
                GObject.Object.__init__(self)
                Signals.__init__(self)

                self.current_language_accel_group = None
Пример #38
0
 def __init__(self):
     GObject.Object.__init__(self)
     Signals.__init__(self)