Esempio n. 1
0
    def update_lcd(self, axis_letter, position, only_offset=False):
        axis_letter = str(axis_letter)

        self.logger.debug(
            'update_lcd ' + axis_letter + ' ' + str(position) + ' ' +
            str(only_offset))
        if not only_offset:
            lcdelement = getattr(
                self.ui, "lcdMachNumber" + axis_letter.upper())
            lcdelement.display(
                ("{0:." + str(conf.get('ui.lcd_precision')) + "f}")
                .format(float(position)))

        offsetlcdelement = getattr(
            self.ui, "lcdWorkNumber" + axis_letter.upper())
        try:
            offset = conf.get(
                'ui.offsets.' + str(conf.get('ui.current_offset_index')) +
                '.' + axis_letter)
            if offset is None:
                raise Exception()
        except:
            offset = 0
            pass

        offsetlcdelement.display(
            ("{0:." + str(conf.get('ui.lcd_precision')) + "f}")
            .format(float(position) - float(offset)))
Esempio n. 2
0
    def __init__(self):
        logging.debug('external init')
        gobject.GObject.__init__(self)
        self.source = conf.get("activities_source")
        self.__gtg_connection = None

        if self.source == "evo" and not evolution:
            self.source == "" # on failure pretend that there is no evolution
        elif self.source == "gtg":
            gobject.GObject.__init__(self)
            dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
        elif self.source == "redmine":
            self.rt_url = conf.get("rt_url")
            self.rt_apikey = conf.get("rt_apikey")
            self.rt_category = conf.get("rt_category_field")
            if self.rt_url and self.rt_apikey:
                try:
                    self.tracker = redmine.Redmine(self.rt_url, auth=(self.rt_apikey,"placeholder"))
                    if not self.tracker:
                        self.source = ""

                except:
                    self.source = ""
            else:
                self.source = ""
    def load_config(self, *args):
        self.get_widget("shutdown_track").set_active(conf.get("stop_on_shutdown"))
        self.get_widget("idle_track").set_active(conf.get("enable_timeout"))
        self.get_widget("notify_interval").set_value(conf.get("notify_interval"))

        self.get_widget("notify_on_idle").set_active(conf.get("notify_on_idle"))
        self.get_widget("notify_on_idle").set_sensitive(conf.get("notify_interval") <=120)

        self.get_widget("workspace_tracking_name").set_active("name" in conf.get("workspace_tracking"))
        self.get_widget("workspace_tracking_memory").set_active("memory" in conf.get("workspace_tracking"))

        day_start = conf.get("day_start_minutes")
        day_start = dt.time(day_start / 60, day_start % 60)
        self.day_start.set_time(day_start)

        self.tags = [tag["name"] for tag in runtime.storage.get_tags(only_autocomplete=True)]
        self.get_widget("autocomplete_tags").set_text(", ".join(self.tags))

        self.workspace_mapping = conf.get("workspace_mapping")
        self.get_widget("workspace_list").set_sensitive(self.get_widget("workspace_tracking_name").get_active())


        current_source = conf.get("activities_source")
        for i, (code, label) in enumerate(self.activities_sources):
            if code == current_source:
                self.todo_combo.set_active(i)
Esempio n. 4
0
    def load_config(self, *args):
        self.get_widget("shutdown_track").set_active(
            conf.get("stop_on_shutdown"))
        self.get_widget("idle_track").set_active(conf.get("enable_timeout"))
        self.get_widget("notify_interval").set_value(
            conf.get("notify_interval"))

        self.get_widget("notify_on_idle").set_active(
            conf.get("notify_on_idle"))
        self.get_widget("notify_on_idle").set_sensitive(
            conf.get("notify_interval") <= 120)

        self.get_widget("workspace_tracking_name").set_active(
            "name" in conf.get("workspace_tracking"))
        self.get_widget("workspace_tracking_memory").set_active(
            "memory" in conf.get("workspace_tracking"))

        day_start = conf.get("day_start_minutes")
        day_start = dt.time(day_start / 60, day_start % 60)
        self.day_start.set_time(day_start)

        self.tags = [
            tag["name"]
            for tag in runtime.storage.get_tags(only_autocomplete=True)
        ]
        self.get_widget("autocomplete_tags").set_text(", ".join(self.tags))

        self.workspace_mapping = conf.get("workspace_mapping")
        self.get_widget("workspace_list").set_sensitive(
            self.get_widget("workspace_tracking_name").get_active())

        current_source = conf.get("activities_source")
        for i, (code, label) in enumerate(self.activities_sources):
            if code == current_source:
                self.todo_combo.set_active(i)
Esempio n. 5
0
    def set_offsets(self):
        self.logger.debug('Setting up offsets')
        self.ui.comboOffset.clear()
        for offset_name in conf.get('ui.offset_names'):
            self.ui.comboOffset.addItem(str(offset_name))

        self.ui.comboOffset.setCurrentIndex(
            int(conf.get('ui.current_offset_index')))
Esempio n. 6
0
 def position_window(self):
     if conf.get("overview_window_maximized"):
         self.window.maximize()
     else:
         window_box = conf.get("overview_window_box")
         if window_box:
             x, y, w, h = (int(i) for i in window_box)
             self.window.move(x, y)
             self.window.resize(w, h)
         else:
             self.window.set_position(gtk.WIN_POS_CENTER)
Esempio n. 7
0
 def position_window(self):
     if conf.get("overview_window_maximized"):
         self.window.maximize()
     else:
         window_box = conf.get("overview_window_box")
         if window_box:
             x, y, w, h = (int(i) for i in window_box)
             self.window.move(x, y)
             self.window.resize(w, h)
         else:
             self.window.set_position(gtk.WIN_POS_CENTER)
Esempio n. 8
0
    def toggle_coolant(self, state):
        command = ''
        if state:
            command += 'M7\nM8'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (coolant on)'
        else:
            command += 'M9'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (coolant off)'

        self.send(command)
Esempio n. 9
0
    def toggle_coolant(self, state):
        command = ''
        if state:
            command += 'M7\nM8'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (coolant on)'
        else:
            command += 'M9'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (coolant off)'

        self.send(command)
Esempio n. 10
0
    def set_units(self, metric=True, imperial=False):
        command = ''

        if metric:
            command += 'G21'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (metric)'
        elif imperial:
            command += 'G20'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (imperial)'

        self.send(command)
Esempio n. 11
0
    def offset_zero(self, axis_letter):
        lcdnumber = getattr(self.ui, 'lcdMachNumber' + axis_letter.upper())
        try:
            conf.set(
                'ui.offsets.' + str(conf.get('ui.current_offset_index')) +
                '.' + axis_letter, lcdnumber.value())
        except:
            conf.set(
                'ui.offsets.' + str(conf.get('ui.current_offset_index')) +
                '.' + axis_letter, 0)
            pass

        self.update_lcd(axis_letter, lcdnumber.value(), True)
Esempio n. 12
0
    def set_distance_mode(self, mode):
        self.logger.debug('set_distance_mode ' + str(mode))
        command = ''
        if mode == 0:
            command += 'G90'  # absolute
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (absolute)'
        elif mode == 1:
            command += 'G91'  # relative
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (relative)'

        self.send(command)
Esempio n. 13
0
    def set_distance_mode(self, mode):
        self.logger.debug('set_distance_mode ' + str(mode))
        command = ''
        if mode == 0:
            command += 'G90'  # absolute
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (absolute)'
        elif mode == 1:
            command += 'G91'  # relative
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (relative)'

        self.send(command)
Esempio n. 14
0
    def set_units(self, metric=True, imperial=False):
        command = ''

        if metric:
            command += 'G21'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (metric)'
        elif imperial:
            command += 'G20'
            if conf.get('common.add_gcode_comments_for_system_commands'):
                command += ' (imperial)'

        self.send(command)
Esempio n. 15
0
    def __init__(self):
        super(MainWindow, self).__init__()

        self.logger = logging.getLogger(__name__)

        driver_class_name = re.sub(
            r'[^a-zA-Z0-9]', '', conf.get('common.board_type'))
        driver_filename = re.sub(
            r'[^a-z0-9]+', '', conf.get('common.board_type').lower())
        driver_directory = re.sub(r'[^a-z]+', '', driver_filename)

        sys.path.append(
            os.path.dirname(os.path.realpath(__file__)) + '/drivers/' +
            driver_directory)
        f, filename, description = imp.find_module(driver_filename)
        driver_module = imp.load_module(
            driver_class_name, f, filename, description)
        driver_class = getattr(driver_module, driver_class_name)

        self.init_ui()

        self.controller = driver_class(self)
        self.logger.debug(driver_class_name + ' driver loaded from ' +
                          'drivers/' + driver_directory + '/' +
                          driver_filename)

        self.logger.debug('Setting up controller to gui events')
        pub.subscribe(self.position_received_handler, 'position-received')
        pub.subscribe(self.velocity_received_handler, 'velocity-received')
        pub.subscribe(self.axis_received_handler, 'axis-received')
        pub.subscribe(self.home_received_handler, 'home-received')
        pub.subscribe(self.line_received_handler, 'line-received')
        pub.subscribe(self.line_sent_handler, 'line-sent')
        pub.subscribe(self.error_received_handler, 'error-received')
        pub.subscribe(self.feed_rate_sent_handler, 'feed-rate-sent')
        pub.subscribe(self.reset_received_handler, 'reset-received')
        pub.subscribe(self.units_received_handler, 'units-received')
        pub.subscribe(self.dist_mode_received_handler, 'dist-mode-received')
        pub.subscribe(self.connect_received_handler, 'connect-received')
        pub.subscribe(self.config_fetched_handler, 'config-fetched')
        pub.subscribe(self.disconnect_received_handler, 'disconnect-received')
        pub.subscribe(self.programme_progress_handler, 'programme-progress')
        pub.subscribe(self.queue_size_handler, 'queue-size')
        pub.subscribe(self.start_of_file_handler, 'start-of-file')
        pub.subscribe(self.end_of_file_handler, 'end-of-file')
        pub.subscribe(self.timer_tick_handler, 'timer-tick')
        pub.subscribe(self.idle_handler, 'idle')
        pub.subscribe(self.busy_handler, 'busy')

        if bool(conf.get('common.auto_connect')):
            self.btn_connect_clicked()
Esempio n. 16
0
    def show(self):
        self.position_window()
        self.window.show_all()

        self.facts = None

        self.day_start = conf.get("day_start_minutes")
        self.day_start = dt.time(self.day_start / 60, self.day_start % 60)

        self.view_date = (
            dt.datetime.today() - dt.timedelta(hours=self.day_start.hour, minutes=self.day_start.minute)
        ).date()

        # set to monday
        self.start_date = self.view_date - dt.timedelta(self.view_date.weekday() + 1)

        # look if we need to start on sunday or monday
        self.start_date = self.start_date + dt.timedelta(stuff.locale_first_weekday())

        # see if we have not gotten carried away too much in all these calculations
        if (self.view_date - self.start_date) == dt.timedelta(7):
            self.start_date += dt.timedelta(7)

        self.end_date = self.start_date + dt.timedelta(6)

        self.current_range = "week"

        self.timechart.day_start = self.day_start

        self.search()
Esempio n. 17
0
    def check_firmware_version(self):
        self.logger.debug('Checking firmware version')

        branch = conf.get('tinyg.firmware_branch')
        if branch is None:
            branch = self.default_firmware_branch_name
            conf.set('tinyg.firmware_branch', branch)

        try:
            response = urllib2.urlopen(
                'https://raw.githubusercontent.com/synthetos/TinyG/' + branch +
                '/firmware/tinyg/tinyg.h')
            html = response.read()

            match = re.search(r'\#define TINYG_FIRMWARE_BUILD\s+([\d\.]+)',
                              html)

            if 'fb' in self.board_config and match is not None:
                groups = match.groups()
                self.logger.debug(' Found ' + groups[0] + ' and we are ' +
                                  self.board_config['fb']['value'])
                return (float(groups[0]) > float(
                    self.board_config['fb']['value']))
        except urllib2.URLError:
            pass

        return False
Esempio n. 18
0
 def __get_todays_facts(self):
     from configuration import conf
     day_start = conf.get("day_start_minutes")
     day_start = dt.time(day_start / 60, day_start % 60)
     today = (dt.datetime.now() - dt.timedelta(hours = day_start.hour,
                                               minutes = day_start.minute)).date()
     return self.__get_facts(today)
Esempio n. 19
0
    def firmware_instructions(self):
        branch = conf.get('tinyg.firmware_branch')
        if branch is None:
            branch = self.default_firmware_branch_name
            conf.set('tinyg.firmware_branch', branch)

        return 'Goto https://github.com/synthetos/TinyG/tree/' + branch
Esempio n. 20
0
    def reset_axis(self, axis, position):
        command = 'G92 ' + axis + str(position)

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (set axis coordinate)'

        self.send(command)
Esempio n. 21
0
    def __init__(self, parent = None):
        self._gui = load_ui_file("stats.ui")
        self.report_chooser = None
        self.window = self.get_widget("stats_window")

        self.parent = parent# determine if app should shut down on close

        self.stat_facts = None

        day_start = conf.get("day_start_minutes")
        day_start = dt.time(day_start / 60, day_start % 60)
        self.timechart = widgets.TimeChart()
        self.timechart.interactive = False
        self.timechart.day_start = day_start

        self.get_widget("explore_everything").add(self.timechart)
        self.get_widget("explore_everything").show_all()

        runtime.storage.connect('activities-changed',self.after_fact_update)
        runtime.storage.connect('facts-changed',self.after_fact_update)

        self.init_stats()

        self.window.set_position(gtk.WIN_POS_CENTER)

        self._gui.connect_signals(self)
        self.window.show_all()
        self.stats()
Esempio n. 22
0
    def request_command_queue_size(self):
        command = '$qr'

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (queue report)'

        self.send(command)
Esempio n. 23
0
    def request_command_queue_size(self):
        command = '$qr'

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (queue report)'

        self.send(command)
Esempio n. 24
0
    def search(self):
        if self.start_date > self.end_date:  # make sure the end is always after beginning
            self.start_date, self.end_date = self.end_date, self.start_date

        search_terms = self.get_widget("search").get_text().decode(
            "utf8", "replace")
        self.facts = runtime.storage.get_facts(self.start_date, self.end_date,
                                               search_terms)

        self.get_widget("export").set_sensitive(len(self.facts) > 0)
        self.get_widget("export_rt").set_sensitive(len(self.facts) > 0)
        self.get_widget("export_rt").set_visible(
            conf.get("activities_source") == "rt")

        self.set_title()

        self.range_pick.set_range(self.start_date, self.end_date,
                                  self.view_date)

        durations = [(fact.start_time, fact.delta) for fact in self.facts]
        self.timechart.draw(durations, self.start_date, self.end_date)

        if self.get_widget("window_tabs").get_current_page() == 0:
            self.overview.search(self.start_date, self.end_date, self.facts)
            self.reports.search(self.start_date, self.end_date, self.facts)
        else:
            self.reports.search(self.start_date, self.end_date, self.facts)
            self.overview.search(self.start_date, self.end_date, self.facts)
Esempio n. 25
0
    def add_tab_to_config(self, ui):
        # return None # no config for now

        tinyg_vbox = QtGui.QVBoxLayout()

        btnExportSettings = QtGui.QPushButton('Export config')
        btnExportSettings.clicked.connect(
            partial(
                getattr(self, 'export_settings'),
                options_window=ui.window()))
        if not self.connected:
            btnExportSettings.setEnabled(False)
        tinyg_vbox.addWidget(btnExportSettings)

        checkBoxEdgeFirmware = QtGui.QCheckBox('Use Edge firmware branch')
        checkBoxEdgeFirmware.setObjectName('tinyg_edge_firmware')
        if conf.get('tinyg.firmware_branch') == 'edge':
            checkBoxEdgeFirmware.setChecked(True)

        tinyg_vbox.addWidget(checkBoxEdgeFirmware)
        tinyg_vbox.addStretch(1)

        tinyg_widget = QtGui.QWidget()
        tinyg_widget.setLayout(tinyg_vbox)
        ui.tabWidget.addTab(tinyg_widget, 'TinyG')
Esempio n. 26
0
    def __init__(self, parent = None):
        self._gui = load_ui_file("stats.ui")
        self.report_chooser = None
        self.window = self.get_widget("stats_window")

        self.parent = parent# determine if app should shut down on close

        self.stat_facts = None

        day_start = conf.get("day_start_minutes")
        day_start = dt.time(day_start / 60, day_start % 60)
        self.timechart = widgets.TimeChart()
        self.timechart.interactive = False
        self.timechart.day_start = day_start

        self.get_widget("explore_everything").add(self.timechart)
        self.get_widget("explore_everything").show_all()

        runtime.storage.connect('activities-changed',self.after_fact_update)
        runtime.storage.connect('facts-changed',self.after_fact_update)

        self.init_stats()

        self.window.set_position(gtk.WIN_POS_CENTER)

        self._gui.connect_signals(self)
        self.window.show_all()
        self.stats()
Esempio n. 27
0
    def show(self):
        self.position_window()
        self.window.show_all()

        self.facts = None

        self.day_start = conf.get("day_start_minutes")
        self.day_start = dt.time(self.day_start / 60, self.day_start % 60)

        self.view_date = (dt.datetime.today() - dt.timedelta(hours = self.day_start.hour,
                                                        minutes = self.day_start.minute)).date()

        #set to monday
        self.start_date = self.view_date - dt.timedelta(self.view_date.weekday() + 1)

        # look if we need to start on sunday or monday
        self.start_date = self.start_date + dt.timedelta(stuff.locale_first_weekday())

        # see if we have not gotten carried away too much in all these calculations
        if (self.view_date - self.start_date) == dt.timedelta(7):
            self.start_date += dt.timedelta(7)

        self.end_date = self.start_date + dt.timedelta(6)

        self.current_range = "week"

        self.timechart.day_start = self.day_start


        self.search()
Esempio n. 28
0
 def find_axis_home(self, axis_letter):
     self.logger.debug('Find home for ' + axis_letter)
     if self.installed_homes.count(str(axis_letter).lower()) > 0:
         command = 'G28.2 ' + axis_letter + '0'
         if conf.get('common.add_gcode_comments_for_system_commands'):
             command += ' (homing ' + axis_letter + ' axis)'
         self.send(command)
Esempio n. 29
0
    def send_file(self, file_path):
        self.pauseState = False

        pub.sendMessage('programme-progress', progress=0)
        pub.sendMessage('queue-size', size=0)

        content = ''
        with open(file_path) as f:
            content = f.read()

        if bool(conf.get('common.filter_file_commands')):
            content = self.filter_file(content)
            # self.logger.debug('filtered file:' + content)

        if content is not None and content != '':
            self.commands_executed = 0
            self.queue_size = 0
            self.number_of_commands = 0
            self.clear_command_queue()

            # wait for the sender to become ready
            while self.sender_thread is not None and \
                    self.sender_thread.isRunning():
                time.sleep(0.3)

            self.tracking_progress = True
            self.timer()
            self.echo_back('start-of-file')
            self.sender(content)
            self.echo_back('end-of-file')
Esempio n. 30
0
 def __get_todays_facts(self):
     from configuration import conf
     day_start = conf.get("day_start_minutes")
     day_start = dt.time(day_start / 60, day_start % 60)
     today = (dt.datetime.now() - dt.timedelta(hours = day_start.hour,
                                               minutes = day_start.minute)).date()
     return self.__get_facts(today)
Esempio n. 31
0
 def find_axis_home(self, axis_letter):
     self.logger.debug('Find home for ' + axis_letter)
     if self.installed_homes.count(str(axis_letter).lower()) > 0:
         command = 'G28.2 ' + axis_letter + '0'
         if conf.get('common.add_gcode_comments_for_system_commands'):
             command += ' (homing ' + axis_letter + ' axis)'
         self.send(command)
Esempio n. 32
0
 def on_start_activate(self, button):
     if conf.get("activities_source") == "":
         logging.warn("Not connected to an external source.")
     else:
         to_report = filter(self.__is_rt_ticket, self.fact_tree.get_model())
         to_report = [row[0].fact for row in to_report]
         dialogs.export_rt.show(self, facts = to_report)
Esempio n. 33
0
    def firmware_instructions(self):
        branch = conf.get('tinyg.firmware_branch')
        if branch is None:
            branch = self.default_firmware_branch_name
            conf.set('tinyg.firmware_branch', branch)

        return 'Goto https://github.com/synthetos/TinyG/tree/' + branch
Esempio n. 34
0
 def on_start_activate(self, button):
     if conf.get("activities_source") == "":
         logging.warn("Not connected to an external source.")
     else:
         to_report = filter(self.__is_rt_ticket, self.fact_tree.get_model())
         to_report = [row[0].fact for row in to_report]
         dialogs.export_rt.show(self, facts=to_report)
Esempio n. 35
0
    def check_firmware_version(self):
        self.logger.debug('Checking firmware version')

        branch = conf.get('tinyg.firmware_branch')
        if branch is None:
            branch = self.default_firmware_branch_name
            conf.set('tinyg.firmware_branch', branch)

        try:
            response = urllib2.urlopen(
                'https://raw.githubusercontent.com/synthetos/TinyG/' +
                branch + '/firmware/tinyg/tinyg.h')
            html = response.read()

            match = re.search(
                r'\#define TINYG_FIRMWARE_BUILD\s+([\d\.]+)', html)

            if 'fb' in self.board_config and match is not None:
                groups = match.groups()
                self.logger.debug(
                    ' Found ' + groups[0] + ' and we are ' +
                    self.board_config['fb']['value'])
                return (
                    float(groups[0]) > float(self.board_config['fb']['value'])
                )
        except urllib2.URLError:
            pass

        return False
Esempio n. 36
0
    def send_file(self, file_path):
        self.pauseState = False

        pub.sendMessage('programme-progress', progress=0)
        pub.sendMessage('queue-size', size=0)

        content = ''
        with open(file_path) as f:
            content = f.read()

        if bool(conf.get('common.filter_file_commands')):
            content = self.filter_file(content)
            # self.logger.debug('filtered file:' + content)

        if content is not None and content != '':
            self.commands_executed = 0
            self.queue_size = 0
            self.number_of_commands = 0
            self.clear_command_queue()

            # wait for the sender to become ready
            while self.sender_thread is not None and \
                    self.sender_thread.isRunning():
                time.sleep(0.3)

            self.tracking_progress = True
            self.timer()
            self.echo_back('start-of-file')
            self.sender(content)
            self.echo_back('end-of-file')
Esempio n. 37
0
    def reset_axis(self, axis, position):
        command = 'G92 ' + axis + str(position)

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (set axis coordinate)'

        self.send(command)
Esempio n. 38
0
    def filter_request(self, line):
        self.logger.debug('Filtering request ' + line)

        if conf.get('common.restrict_file_precision') == 1:
            line = line.replace(r'([XYZIJKRP])\s*([\-\+\d])(\.(\d{0,4})\d*)?',
                                r'\1\2\4')

        return line
Esempio n. 39
0
    def filter_request(self, line):
        self.logger.debug('Filtering request ' + line)

        if conf.get('common.restrict_file_precision') == 1:
            line = line.replace(
                r'([XYZIJKRP])\s*([\-\+\d])(\.(\d{0,4})\d*)?', r'\1\2\4')

        return line
Esempio n. 40
0
    def save_options_to_file(self, options_window):
        self.set_options()

        filename = QtGui.QFileDialog.getSaveFileName(
            options_window, 'Choose Filename',
            conf.get('common.directory') + '/cender.config',
            'Config (*.config)')
        conf.save_to_file(filename)
Esempio n. 41
0
 def select_file(self):
     new_file_path = QtGui.QFileDialog.getOpenFileName(
         self,
         'Open GCode',
         conf.get('common.directory'),
         'All Files (*.*);;GCode (*.ngc *.gc *.txt);;Config (*.config)')
     if new_file_path != self.ui.lineFilePath.text():
         pub.sendMessage('programme-progress', progress=0)
     self.ui.lineFilePath.setText(new_file_path)
Esempio n. 42
0
 def __get_todays_facts(self):
     try:
         day_start = conf.get("day_start_minutes")
     except:
         day_start = 5 * 60 # default day start to 5am
     day_start = dt.time(day_start / 60, day_start % 60)
     today = (dt.datetime.now() - dt.timedelta(hours = day_start.hour,
                                               minutes = day_start.minute)).date()
     return self.__get_facts(today)
Esempio n. 43
0
 def __get_todays_facts(self):
     try:
         day_start = conf.get("day_start_minutes")
     except:
         day_start = 5 * 60 # default day start to 5am
     day_start = dt.time(day_start / 60, day_start % 60)
     today = (dt.datetime.now() - dt.timedelta(hours = day_start.hour,
                                               minutes = day_start.minute)).date()
     return self.__get_facts(today)
Esempio n. 44
0
 def show(self):
     self.window.show_all()
     self.stat_facts = None
     day_start = conf.get("day_start_minutes")
     day_start = dt.time(day_start / 60, day_start % 60)
     self.timechart.day_start = day_start
     self.init_stats()
     self.get_widget("year_box").get_children()[0].set_active(True)
     self.stats()
Esempio n. 45
0
 def show(self):
     self.window.show_all()
     self.stat_facts = None
     day_start = conf.get("day_start_minutes")
     day_start = dt.time(day_start / 60, day_start % 60)
     self.timechart.day_start = day_start
     self.init_stats()
     self.get_widget("year_box").get_children()[0].set_active(True)
     self.stats()
Esempio n. 46
0
    def find_home(self):

        if conf.get('ui.disable_homing'):
            return None

        command = ''

        for axis in self.installed_homes:
            lcdelement = getattr(self.main_window.ui,
                                 'lcdMachNumber' + axis.upper())
            if lcdelement.isEnabled():
                self.logger.debug(axis + ' ' + str(lcdelement.value() * -1))
                command += (axis + '0')

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (homing)'

        if command != '':
            self.send('G28.2 ' + command)
Esempio n. 47
0
 def __get_todays_facts(self):
     try:
         from configuration import conf
         day_start = conf.get("day_start_minutes")
         day_start = dt.time(floor(day_start / 60), int(day_start) % 60)
     except:
         day_start = dt.time(5, 0) # default day start to 5am
     today = (dt.datetime.now() - dt.timedelta(hours = day_start.hour,
                                               minutes = day_start.minute)).date()
     return self.__get_facts(today)
Esempio n. 48
0
    def __init__(self):
        gobject.GObject.__init__(self)
        self.source = conf.get("activities_source")
        self.__gtg_connection = None

        if self.source == "evo" and not evolution:
            self.source == "" # on failure pretend that there is no evolution
        elif self.source == "gtg":
            gobject.GObject.__init__(self)
            dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
Esempio n. 49
0
    def __init__(self):
        gobject.GObject.__init__(self)
        self.source = conf.get("activities_source")
        self.__gtg_connection = None

        if self.source == "evo" and not evolution:
            self.source == ""  # on failure pretend that there is no evolution
        elif self.source == "gtg":
            gobject.GObject.__init__(self)
            dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
Esempio n. 50
0
    def find_home(self):

        if conf.get('ui.disable_homing'):
            return None

        command = ''

        for axis in self.installed_homes:
            lcdelement = getattr(
                self.main_window.ui, 'lcdMachNumber' + axis.upper())
            if lcdelement.isEnabled():
                self.logger.debug(axis + ' ' + str(lcdelement.value() * -1))
                command += (axis + '0')

        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (homing)'

        if command != '':
            self.send('G28.2 ' + command)
Esempio n. 51
0
    def context_menu_lcd(self, point):
        if self.controller.connected:
            lcd_element = self.sender()
            self.logger.debug(
                'context_menu_lcd ' + str(lcd_element.objectName()))
            self.lcd_menu = QtGui.QMenu(self)
            zero_action = QtGui.QAction('Zero', self)
            gotoAction = QtGui.QAction('Goto', self)
            resetAction = QtGui.QAction('Reset', self)
            homeAction = QtGui.QAction('Home', self)

            match = re.search(r'([A-Z])$', lcd_element.objectName())
            if match is not None:
                groups = match.groups()
                axis_letter = str(groups[0])
                if re.search(r'^lcdWork', lcd_element.objectName()):
                    zero_action.triggered.connect(
                        getattr(self, 'offset_zero_' + axis_letter.lower()))
                    gotoAction.triggered.connect(
                        partial(
                            getattr(self, 'goto'),
                            axis_letter=axis_letter,
                            offset=False))
                    resetAction.triggered.connect(
                        partial(
                            getattr(self, 'reset'),
                            axis_letter=axis_letter,
                            offset=False))
                else:
                    zero_action.triggered.connect(
                        getattr(self, 'zero_' + axis_letter.lower()))
                    gotoAction.triggered.connect(
                        partial(
                            getattr(self, 'goto'),
                            axis_letter=axis_letter,
                            offset=True))
                    resetAction.triggered.connect(
                        partial(
                            getattr(self, 'reset'),
                            axis_letter=axis_letter,
                            offset=True))

                    if len(self.controller.installed_homes) > 0 and \
                            self.controller.installed_homes.count(axis_letter.lower()) > 0 and \
                            conf.get('ui.disable_homing') is not True:
                        homeAction.triggered.connect(
                            partial(
                                getattr(self, 'find_axis_home'),
                                axis_letter=axis_letter))
                        self.lcd_menu.addAction(homeAction)

            self.lcd_menu.addAction(zero_action)
            self.lcd_menu.addAction(gotoAction)
            self.lcd_menu.addAction(resetAction)
            self.lcd_menu.popup(QtGui.QCursor.pos())
Esempio n. 52
0
    def fetch_board_config(self):
        pub.subscribe(self.config_fetched_handler, 'config-received')

        self.fetch_position()

        command = '$$'
        if conf.get('common.add_gcode_comments_for_system_commands'):
            command += ' (config)'

        self.send(command)
        self.echo_back('config')