class BackgroundPallete(object):


    #----------------------------------------------------------------------
    def __init__(self):
        """Constructor"""

        self.PinguinoColor = "#AFC8E1"  #RGB(175, 200, 225)


    #----------------------------------------------------------------------
    def set_background_pinguino(self, widget):

        palette = QtGui.QPalette(widget.palette())
        widget.setAutoFillBackground(True)
        palette.setColor(QtGui.QPalette.Window, QtGui.QColor(self.PinguinoColor))
        widget.setPalette(palette)


    ##----------------------------------------------------------------------
    #def set_active_background(self, widget):
        #
        #palette = QtGui.QPalette(widget.palette())
        #widget.setAutoFillBackground(True)
        #palette.setColor(QtGui.QPalette.Active, QtGui.QColor(self.PinguinoColor))
        #widget.setPalette(palette)



    #----------------------------------------------------------------------
    def save_palette(self, widget):

        self.default_palette = QtGui.QPalette(widget.palette())


    #----------------------------------------------------------------------
    def get_default_palette(self):

        return self.default_palette


    #----------------------------------------------------------------------
    def set_default_palette(self, widget):

        widget.setAutoFillBackground(True)
        widget.setPalette(self.get_default_palette())


    #----------------------------------------------------------------------
    def set_palette(self, widget, palette):

        widget.setAutoFillBackground(True)
        widget.setPalette(palette) class PinguinoEvents(PinguinoCore):

    #----------------------------------------------------------------------
    def __init__(self):
        """"""
        PinguinoCore.__init__(self)


    #----------------------------------------------------------------------
    def connect_events(self):
        """"""

        # Triggers
        self.connect(self.main.actionNew_file, QtCore.SIGNAL("triggered()"), self.ide_new_file)
        self.connect(self.main.actionNew_blocks_file, QtCore.SIGNAL("triggered()"), self.PinguinoKIT.ide_new_file)
        self.connect(self.main.actionOpen_file, QtCore.SIGNAL("triggered()"), self.ide_open_files)
        self.connect(self.main.actionSave_file, QtCore.SIGNAL("triggered()"), self.ide_save_file)
        self.connect(self.main.actionSave_as, QtCore.SIGNAL("triggered()"), self.ide_save_as)
        self.connect(self.main.actionSave_all, QtCore.SIGNAL("triggered()"), self.ide_save_all)
        self.connect(self.main.actionClose_file, QtCore.SIGNAL("triggered()"), self.ide_close_file)
        self.connect(self.main.actionClose_all, QtCore.SIGNAL("triggered()"), self.ide_close_all)
        self.connect(self.main.actionClose_others, QtCore.SIGNAL("triggered()"), self.ide_close_others)
        self.connect(self.main.actionPrint, QtCore.SIGNAL("triggered()"), self.editor_print_file)
        self.connect(self.main.actionQuit, QtCore.SIGNAL("triggered()"), self.ide_close_ide)
        self.connect(self.main.actionUndo, QtCore.SIGNAL("triggered()"), self.editor_undo)
        self.connect(self.main.actionRedo, QtCore.SIGNAL("triggered()"), self.editor_redo)
        self.connect(self.main.actionCut, QtCore.SIGNAL("triggered()"), self.editor_cut)
        self.connect(self.main.actionCopy, QtCore.SIGNAL("triggered()"), self.editor_copy)
        self.connect(self.main.actionPaste, QtCore.SIGNAL("triggered()"), self.editor_paste)
        self.connect(self.main.actionDelete, QtCore.SIGNAL("triggered()"), self.editor_delete)
        self.connect(self.main.actionSelect_all, QtCore.SIGNAL("triggered()"), self.editor_select_all)
        self.connect(self.main.actionComment_out_region, QtCore.SIGNAL("triggered()"), self.editor_comment_region)
        self.connect(self.main.actionComment_Uncomment_region, QtCore.SIGNAL("triggered()"), self.editor_comment_uncomment)
        self.connect(self.main.actionIndent, QtCore.SIGNAL("triggered()"), self.editor_indent_region)
        self.connect(self.main.actionDedent, QtCore.SIGNAL("triggered()"), self.editor_dedent_region)
        # self.connect(self.main.actionHex_code, QtCore.SIGNAL("triggered()"), self.__show_hex_code__)
        self.connect(self.main.actionMain_c, QtCore.SIGNAL("triggered()"), self.ide_show_main_c)
        self.connect(self.main.actionUser_c, QtCore.SIGNAL("triggered()"), self.ide_show_user_c)
        self.connect(self.main.actionDefine_h, QtCore.SIGNAL("triggered()"), self.ide_show_define_h)
        self.connect(self.main.actionHex, QtCore.SIGNAL("triggered()"), self.ide_show_hex)
        self.connect(self.main.actionReset_IDE_instalation, QtCore.SIGNAL("triggered()"), self.ide_reset_instalation)


        # Toggle Tabs
        self.connect(self.main.actionTabLog, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Log"))
        self.connect(self.main.actionTabFiles, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Files"))
        self.connect(self.main.actionTabBoards, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Boards"))
        self.connect(self.main.actionTabStdout, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Stdout"))
        self.connect(self.main.actionTabSearch, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Search"))
        self.connect(self.main.actionTabProject, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Project"))
        self.connect(self.main.actionTabShell, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Shell"))
        self.connect(self.main.actionTabSourceBrowser, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("SourceBrowser"))
        self.connect(self.main.actionLibraryManager, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("LibraryManager"))
        self.connect(self.main.actionTabPaths, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("Paths"))
        #self.connect(self.main.actionTabICSP, QtCore.SIGNAL("toggled(bool)"), lambda :self.toggle_tab("ICSP"))


        # Perspective related events
        self.connect(self.main.actionMenubar, QtCore.SIGNAL("toggled(bool)"), self.toggle_menubar)
        self.connect(self.main.actionToolbars, QtCore.SIGNAL("toggled(bool)"), self.toggle_toolbars)
        self.connect(self.main.actionToggle_horizontal_tool_area, QtCore.SIGNAL("triggered()"), self.toggle_bottom_area)
        self.connect(self.main.actionToggle_vertical_tool_area, QtCore.SIGNAL("triggered()"), self.toggle_right_area)
        self.connect(self.main.tabWidget_tools, QtCore.SIGNAL("currentChanged(int)"), self.tab_right_changed)
        self.connect(self.main.tabWidget_bottom, QtCore.SIGNAL("currentChanged(int)"), self.tab_bottoms_changed)
        # self.connect(self.main.actionToggle_editor_area, QtCore.SIGNAL("toggled(bool)"), self.toggle_editor_area)
        self.connect(self.main.actionMove_vertical_tool_area, QtCore.SIGNAL("triggered()"), self.toggle_side_vertical_area)


        # Settings related events
        self.connect(self.main.actionAutocomplete, QtCore.SIGNAL("triggered()"), self.switch_autocomplete)
        self.connect(self.main.actionColor_theme, QtCore.SIGNAL("toggled(bool)"), self.switch_color_theme)
        self.connect(self.main.action16x16, QtCore.SIGNAL("triggered(bool)"), self.resize_toolbar(16, self.main.action16x16))
        self.connect(self.main.action24x24, QtCore.SIGNAL("triggered(bool)"), self.resize_toolbar(24, self.main.action24x24))
        self.connect(self.main.action32x32, QtCore.SIGNAL("triggered(bool)"), self.resize_toolbar(32, self.main.action32x32))
        self.connect(self.main.action48x48, QtCore.SIGNAL("triggered(bool)"), self.resize_toolbar(48, self.main.action48x48))


        # Child windows
        # self.connect(self.main.actionLibrary_manager, QtCore.SIGNAL("triggered()"), self.__show_libmanager__)
        # self.connect(self.main.actionSet_paths, QtCore.SIGNAL("triggered()"), self.__config_paths__)
        self.connect(self.main.actionSelect_board, QtCore.SIGNAL("triggered()"), self.set_tab_board)
        # self.connect(self.main.actionView_Pinguino_code, QtCore.SIGNAL("triggered()"), self.__show_pinguino_code__)
        self.connect(self.main.actionInsert_Block, QtCore.SIGNAL("triggered()"), self.__show_insert_block__)
        self.connect(self.main.actionSubmit_bug_report, QtCore.SIGNAL("triggered()"), self.__show_submit_bug__)
        # self.connect(self.main.actionCheck_for_patches, QtCore.SIGNAL("triggered()"), self.__show_patches__)


        # Pinguino related events
        self.connect(self.main.actionCompile, QtCore.SIGNAL("triggered()"), self.pinguino_compile)
        self.connect(self.main.actionUpload, QtCore.SIGNAL("triggered()"), self.pinguino_upload)
        self.connect(self.main.actionUpload_hex_directly, QtCore.SIGNAL("triggered()"), self.pinguino_upload_hex)
        self.connect(self.main.actionIf_Compile_then_Upload, QtCore.SIGNAL("triggered()"), self.pinguino_compile_and_upload)


        # Help
        self.connect(self.main.actionGitPinguinoIde, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("https://github.com/PinguinoIDE/pinguino-ide/releases/latest"))
        self.connect(self.main.actionGitPinguinoLibraries, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("https://github.com/PinguinoIDE/pinguino-libraries"))
        self.connect(self.main.actionGitPinguinoCompilers, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("https://github.com/PinguinoIDE/pinguino-compilers"))
        self.connect(self.main.actionWebsite, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("http://www.pinguino.cc/"))
        self.connect(self.main.actionWiki, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("http://wiki.pinguino.cc/"))
        self.connect(self.main.actionForum, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("http://forum.pinguino.cc/"))
        self.connect(self.main.actionBlog, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("http://blog.pinguino.cc/"))
        self.connect(self.main.actionGroup, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("https://groups.google.com/forum/#!forum/pinguinocard"))
        self.connect(self.main.actionShop, QtCore.SIGNAL("triggered()"), lambda :self.open_web_site("http://shop.pinguino.cc/"))
        self.connect(self.main.actionAbout, QtCore.SIGNAL("triggered()"), self.__show_about__)
        # self.connect(self.main.actionCheck_for_updates, QtCore.SIGNAL("triggered()"), self.need_update)


        # Events
        self.closeEvent = self.ide_close_ide
        # self.connect(self.main.actionSwitch_ide, QtCore.SIGNAL("toggled(bool)"), self.switch_ide_mode)
        self.connect(self.main.tabWidget_files, QtCore.SIGNAL("currentChanged(int)"), self.ide_tab_changed)
        self.connect(self.main.tabWidget_files, QtCore.SIGNAL("tabCloseRequested(int)"), self.ide_tab_close)
        # self.connect(self.main.tabWidget_bottom, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.ide_tabs_context_menu)
        # self.connect(self.main.tabWidget_tools, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.ide_tabs_context_menu)
        # self.connect(self.main.tabWidget_files, QtCore.SIGNAL("tabCloseRequested(int)"), self.ide_tab_close)


        # Graphical mode
        self.connect(self.main.actionSave_image, QtCore.SIGNAL("triggered()"), self.editor_save_screen_image)
        self.connect(self.main.lineEdit_blocks_search, QtCore.SIGNAL("textChanged(QString)"), self.PinguinoKIT.update_blocks_search_tab)
        self.connect(self.main.actionExport_code_to_editor, QtCore.SIGNAL("triggered()"), self.editor_export_pinguino_code)
        self.connect(self.main.comboBox_blocks, QtCore.SIGNAL("activated(QString)"), self.set_block_tab)
        self.connect(self.main.actionGenerate_blocks, QtCore.SIGNAL("triggered()"), self.PinguinoKIT.code_to_blocks)


        # Context menu
        self.main.tabWidget_files.contextMenuEvent = self.editor_tabfile_context_menu
        self.main.tabWidget_files.contextMenuEvent = self.editor_tabfile_context_menu


        # Initialize
        self.main.actionToolbars.setChecked(True)
        # self.main.actionConfirm_board.setChecked(self.configIDE.config("Features", "confirm_board", True))

        self.main.dockWidget_right.resizeEvent = self.tab_tools_resize
        self.main.dockWidget_bottom.resizeEvent = self.tab_tools_resize

        self.main.tabWidget_bottom.contextMenuEvent = self.ide_tabs_context_menu
        self.main.tabWidget_tools.contextMenuEvent = self.ide_tabs_context_menu
        self.main.toolBar.contextMenuEvent = self.ide_tabs_context_menu
        self.main.menubar.contextMenuEvent = self.ide_tabs_context_menu class Decorator(object):

    #----------------------------------------------------------------------
    @classmethod
    def requiere_open_files(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.get_tab().count():
                    return fn(Pinguino, *args, **kwargs)
                else:
                    #print("No files are open.")
                    return None
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def timer(cls, time_):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                name = "timer_" + fn.__name__
                setattr(Pinguino, name, QtCore.QTimer())
                atr = getattr(Pinguino, name)
                QtCore.QObject.connect(atr, QtCore.SIGNAL("timeout()"), lambda :fn(Pinguino, *args, **kwargs))
                atr.start(time_)
                return name, atr
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def call_later(cls, time_=100):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                QtCore.QTimer.singleShot(time_, lambda :fn(Pinguino, *args, **kwargs))
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def requiere_browser_tab(cls, name):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                current_tab_name = Pinguino.main.tabWidget_browser.currentWidget().objectName()
                Pinguino.main.tabWidget_browser.accessibleName
                if current_tab_name == name:
                    return fn(Pinguino, *args, **kwargs)
                else:
                    #print(name + " not in focus.")
                    return None
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def requiere_tools_tab(cls, name):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                current_tab_name = Pinguino.main.tabWidget_tools.currentWidget().objectName()
                if current_tab_name == name:
                    return fn(Pinguino, *args, **kwargs)
                else:
                    #print(name + " not in focus.")
                    return None
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def requiere_text_mode(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if (Pinguino.is_graphical() is False) and (not Pinguino.is_widget()):
                    # editor = Pinguino.get_tab().currentWidget()
                    # if editor.objectName() == "PinguinoCodeEditor":
                        # return fn(Pinguino, *args, **kwargs)
                    # else: return None
                    if Pinguino.is_graphical() is False:
                        return fn(Pinguino, *args, **kwargs)
                    elif Pinguino.is_graphical() is True:
                        return None
                else: return None
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def requiere_graphical_mode(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.is_graphical() is True:
                    return fn(Pinguino, *args, **kwargs)
                elif Pinguino.is_graphical() is False:
                    return None
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def requiere_main_focus(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.isActiveWindow():
                    return fn(Pinguino, *args, **kwargs)
                else:
                    #print("Main inactive.")
                    return None
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def requiere_line_edit_content(cls, line_edit):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if getattr(getattr(Pinguino, line_edit.split(".")[0]), line_edit.split(".")[1]).text():
                    return fn(Pinguino, *args, **kwargs)
                else:
                    return None
            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def requiere_file_saved(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.is_graphical() is True:
                    saved = Pinguino.PinguinoKIT.ide_save_file(*args, **kwargs)
                    if saved: fn(Pinguino, *args, **kwargs)
                    else: Dialogs.save_before_compile(Pinguino)
                elif Pinguino.is_graphical() is False:
                    saved = Pinguino.ide_save_file(*args, **kwargs)
                    if saved: fn(Pinguino, *args, **kwargs)
                    else: Dialogs.save_before_compile(Pinguino)
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def requiere_can_compile(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if os.getenv("PINGUINO_CAN_COMPILE") == "True":
                    return fn(Pinguino, *args, **kwargs)
                else:
                    #print("Missing libraries and/or compiler")
                    Dialogs.warning_message(Pinguino, QtWidgets.QApplication.translate("Dialogs", "Impossible to compile this file, missing libraries and/or compiler."))
                    return None
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def update_toolbar(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                count = Pinguino.get_tab().count()
                Pinguino.main.actionCompile.setEnabled(bool(count))
                Pinguino.main.actionClose_file.setEnabled(bool(count))
                Pinguino.main.actionSearch.setEnabled(bool(count))
                Pinguino.main.actionSearch_and_replace.setEnabled(bool(count))
                Pinguino.main.actionPaste.setEnabled(bool(count))

                if not count:
                    Pinguino.main.actionUpload.setEnabled(False)


                if Pinguino.is_graphical() is False:
                    editor = Pinguino.get_current_editor()
                    textcursor = editor.text_edit.textCursor()
                    Pinguino.main.actionCut.setEnabled(bool(textcursor.selectedText()))
                    Pinguino.main.actionCopy.setEnabled(bool(textcursor.selectedText()))

                else:
                    Pinguino.main.actionCut.setEnabled(False)
                    Pinguino.main.actionCopy.setEnabled(False)
                    Pinguino.main.actionUndo.setEnabled(False)
                    Pinguino.main.actionRedo.setEnabled(False)


                return fn(Pinguino, *args, **kwargs)
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def connect_features(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.is_graphical() is True:
                    return getattr(Pinguino.PinguinoKIT, fn.__name__)(Pinguino, *args, **kwargs)
                elif Pinguino.is_graphical() is False:
                    return fn(Pinguino, *args, **kwargs)
            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def if_autocomplete_is_enable(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                if Pinguino.main.actionAutocomplete.isChecked():
                    return fn(Pinguino, *args, **kwargs)
                #else: return None
            return wrapped
        return actualdecorator


    # #----------------------------------------------------------------------
    # @classmethod
    # def debug_time(cls):
        # def actualdecorator(fn):
            # @functools.wraps(fn)
            # def wrapped(Pinguino, *args, **kwargs):
                # inicio = time.time()
                # retorno = fn(Pinguino, *args, **kwargs)
                # fin = time.time()
                # Pinguino.write_log("debug: " + fn.__name__ + "\nTime: %.7fs\n" %(fin - inicio))
                # return retorno
            # return wrapped
        # return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def clear_highlighted_lines(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):
                Pinguino.editor_clear_highlighted_lines()
                return fn(Pinguino, *args, **kwargs)
            return wrapped
        return actualdecorator



    #----------------------------------------------------------------------
    @classmethod
    def debug_method(cls):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):

                try:
                    return fn(Pinguino, *args, **kwargs)
                except:
                    error = traceback.format_exc()
                    logging.debug(error)
                    cls.submmit_bug = SubmitBug(Pinguino, error)
                    cls.submmit_bug.show()
                    return

            return wrapped
        return actualdecorator


    #----------------------------------------------------------------------
    @classmethod
    def alert_tab(cls, widget_name):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):

                widget = getattr(Pinguino.main, widget_name)

                tab = widget.parent().parent()
                index = tab.indexOf(widget)
                tabbar = tab.tabBar()
                orig_c = tabbar.tabTextColor(0)

                for i in range(0, 8, 2):
                    QtCore.QTimer.singleShot(300*i, lambda :tabbar.setTabTextColor(index, orig_c))
                    QtCore.QTimer.singleShot((300*i)+300, lambda :tabbar.setTabTextColor(index, QtCore.Qt.red))
                QtCore.QTimer.singleShot(500*20, lambda :tabbar.setTabTextColor(index, orig_c))
                return fn(Pinguino, *args, **kwargs)

            return wrapped
        return actualdecorator

    #----------------------------------------------------------------------
    @classmethod
    def show_tab(cls, widget_name):
        def actualdecorator(fn):
            @functools.wraps(fn)
            def wrapped(Pinguino, *args, **kwargs):

                widget = getattr(Pinguino.main, widget_name)

                tab = widget.parent().parent()
                index = tab.indexOf(widget)
                tab.setCurrentIndex(index)

                return fn(Pinguino, *args, **kwargs)

            return wrapped
        return actualdecorator

    # #----------------------------------------------------------------------
    # @classmethod
    # def reload_project(cls):
        # def actualdecorator(fn):
            # @functools.wraps(fn)
            # def wrapped(Pinguino, *args, **kwargs):

                # if Pinguino.is_project():
                    # Pinguino.reload_project()

                # return fn(Pinguino, *args, **kwargs)

            # return wrapped
        # return actualdecorator class CompleteIcons(object):


    #----------------------------------------------------------------------
    def __init__(self):

        self.iconFunction = QtGui.QIcon()
        self.iconFunction.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/function.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconLibrary = QtGui.QIcon()
        self.iconLibrary.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/library.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconBratches = QtGui.QIcon()
        self.iconBratches.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/vectors.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconCuotation = QtGui.QIcon()
        self.iconCuotation.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/cuotation.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconFloat = QtGui.QIcon()
        self.iconFloat.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/float.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconInt = QtGui.QIcon()
        self.iconInt.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/int.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconReserved = QtGui.QIcon()
        self.iconReserved.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/reserved.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconBool = QtGui.QIcon()
        self.iconBool.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/bool.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconByte = QtGui.QIcon()
        self.iconByte.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/byte.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconDouble = QtGui.QIcon()
        self.iconDouble.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/double.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconEnum = QtGui.QIcon()
        self.iconEnum.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/enum.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconLong = QtGui.QIcon()
        self.iconLong.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/long.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconShort = QtGui.QIcon()
        self.iconShort.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/short.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconStruct = QtGui.QIcon()
        self.iconStruct.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/struct.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconUnion = QtGui.QIcon()
        self.iconUnion.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/union.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconWord = QtGui.QIcon()
        self.iconWord.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/word.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconSnippet = QtGui.QIcon()
        self.iconSnippet.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/snippet.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)

        self.iconDirectives = QtGui.QIcon()
        self.iconDirectives.addPixmap(QtGui.QPixmap(":/autocompleter/autocompleter/directivas.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) class PinguinoAutoCompleter(QListWidget):
    """
    Rules:

    * Visible after 2 keys (self.setSpell(2))
    * Don't show with nodifiers
    * Don't show with backspace
    * When no matchs autocompleter must be visible
    * Autocompleter must hidding with space key



    """

    #----------------------------------------------------------------------
    def __init__(self):
        super(PinguinoAutoCompleter, self).__init__(None)

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
                            QtCore.Qt.WindowSystemMenuHint |
                            QtCore.Qt.WindowStaysOnTopHint |
                            QtCore.Qt.Tool)

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/logo/art/windowIcon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.setWindowIcon(icon)

        self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)

        self.setIconSize(QtCore.QSize(14, 14))
        self.set_height(300)

        self.setSpell(2)
        self.setEnabled(True)
        self.itemsList = []
        self.itemsListName = []
        self.local_functions = {}
        self.temporal = {"variables" : [],
                         "functions" : [],
                         "directives" : [],
                         "arch8" : [],
                         "arch32" : [],
                         }

        with open(os.path.join(os.getenv("PINGUINO_USER_PATH"), "reserved.pickle"), "rb") as file_reserved:
            self.namespaces = pickle.load(file_reserved)

        self.icons = CompleteIcons()
        self.addItemsCompleter(self.namespaces["all"], self.icons.iconLibrary)
        self.addItemsCompleter(self.namespaces["arch8"], self.icons.iconLibrary)
        self.addItemsCompleter(self.namespaces["arch32"], self.icons.iconLibrary)
        #self.add_arch_autocompleter()

        self.sortItems()
        self.itemsList.sort()

        configIDE = Config()
        selection_color = configIDE.config("Styles", "selection_color", "#FFFFFF")
        selection_bg_color = configIDE.config("Styles", "selection_foreground_color", "#57AAFF")

        self.setStyleSheet("""
        font-family: inherit;
        font-weight: normal;
        selection-color: {};
        selection-background-color: {};
        """.format(selection_color, selection_bg_color))

        self.setFrameShape(QtWidgets.QFrame.NoFrame)


    ##----------------------------------------------------------------------
    #def add_arch_autocompleter(self):

        ##arch = os.getenv("PINGUINO_BOARD_ARCH")

        #icons = CompleteIcons()

        ##if arch == "8":
        #for item in self.namespaces["arch8"]:
            #self.addTemporalItem("arch8", item, icons.iconLibrary)
        #self.removeTemporalItems("arch32")

        ##elif arch == "32":
        #for item in self.namespaces["arch32"]:
            #self.addTemporalItem("arch32", item, icons.iconLibrary)
        #self.removeTemporalItems("arch8")

        #del icons

    #----------------------------------------------------------------------
    def hide(self, *args):
        super(PinguinoAutoCompleter, self).hide(*args)
        self.text_edit.setFocus()

    #----------------------------------------------------------------------
    def show(self, *args):
        #self.set_arch_autocompleter()  #FIXME: move this call
        self.activateWindow()
        super(PinguinoAutoCompleter, self).show(*args)

    #----------------------------------------------------------------------
    def focusOutEvent(self, event):
        self.hide()
        QtGui.QListWidget.focusOutEvent(self, event)

    #----------------------------------------------------------------------
    def setEnabled(self, en):
        self.enabled = en

    #----------------------------------------------------------------------
    def set_height(self, visisble):
        self.resize(200, visisble)

    #----------------------------------------------------------------------
    def ajustWidth(self):
        hs = self.horizontalScrollBar()
        cont = 0
        while hs.isVisible() :
            self.resize(self.width()+1, self.height())
            cont += 1
            if cont > 100: return # :)

    #----------------------------------------------------------------------
    def ajustPos(self):
        screen = QtGui.QDesktopWidget().screenGeometry()
        size = self.geometry()

        cont = 0
        while self.pos().y() + size.height() - screen.height() > -10:
            self.move(self.pos().x(), self.pos().y() - 5)
            cont += 1
            if cont > 100: self.destroy()

        cont = 0
        while self.pos().x() + size.width() - screen.width() > -10:
            self.move(self.pos().x() - 5, self.pos().y())
            cont += 1
            if cont > 100: self.destroy()


    #----------------------------------------------------------------------
    def setSpell(self, int_):
        self.spell = int_

    #----------------------------------------------------------------------
    def down(self):
        current = self.currentRow()
        self.setCurrentRow(current+1)

    #----------------------------------------------------------------------
    def up(self):
        current = self.currentRow()
        self.setCurrentRow(current-1)

    #----------------------------------------------------------------------
    def addNewItem(self, name, icon=None):

        if os.getenv("PINGUINO_PYTHON") is "2":
            if not icon: icon = None
            elif type(icon) in [str, unicode]: icon = getattr(self.icons, icon)
        elif os.getenv("PINGUINO_PYTHON") is "3":
            if not icon: icon = None
            elif type(icon) == str: icon = getattr(self.icons, icon)

        if not name in self.itemsListName:
            item = QListWidgetItem()
            if icon: item.setIcon(icon)
            item.setText(name)
            self.addItem(item)
            self.itemsList.append(item)
            self.itemsListName.append(name)
            return item


    #----------------------------------------------------------------------
    def addTemporalItem(self, llave, name, icon=None):
        # if not icon: icon = None
        # elif type(icon) == str: icon = getattr(self.icons, icon)

        if not isinstance(name, list):
            name = [name]

        for n in name:
            item = self.addNewItem(n, icon)
            if item:
                self.temporal[llave].append(item)

    #----------------------------------------------------------------------
    def update_local_functions(self, functions):
        """"""
        self.local_functions = functions


    #----------------------------------------------------------------------
    def removeTemporalItems(self, llave):

        for item in self.temporal[llave]:
            index = self.getIndex(item.text())
            if index:
                self.itemsList.pop(index)
                #self.itemsList.remove(item)
                self.itemsListName.remove(item.text())
                self.takeItem(index)
        self.update()
        self.temporal[llave] = []

    #----------------------------------------------------------------------
    def getIndex(self, name, start=False):
        cont = 0
        for item in self.itemsList:
            if start:
                if item.text().lower().startswith(name.lower()): return cont
            else:
                if item.text() == name: return cont
            cont += 1
        return None

    #----------------------------------------------------------------------
    def addItemsCompleter(self, list_, icon=None):

        if os.getenv("PINGUINO_PYTHON") is "2":
            if not icon: icon = None
            elif type(icon) in [str, unicode]: icon = getattr(self.icons, icon)
        elif os.getenv("PINGUINO_PYTHON") is "3":
            if not icon: icon = None
            elif type(icon) == str: icon = getattr(self.icons, icon)

        for text in list_:
            if not text in self.itemsListName:
                item = QListWidgetItem()
                if icon != None: item.setIcon(icon)
                item.setText(text)
                self.addItem(item)
                self.itemsList.append(item)
                self.itemsListName.append(item.text())


    #----------------------------------------------------------------------
    def popup(self, pos, index=None):

        ###hide autocompleter after 3s
        ##hide_timer = QtCore.QTimer()
        ##QtCore.QTimer.singleShot(3000, self.hide)
        ##hide_timer.setSingleShot(True)
        ##hide_timer.start()

        #self.sortItems()
        #self.itemsList.sort()

        if index == None:
            self.setCurrentRow(0)
            self.move(pos)
            self.show()
            self.setFocus()
            self.ajustWidth()
            self.ajustPos()
            return

        cont = self.getIndex(index, True)
        ##if not cont:
            ##self.hide()
            ##return

        if self.enabled and cont:
            self.setCurrentRow(cont)
            item = cont + 5
            if item >= len(self.itemsList): item = -1
            self.scrollToItem(self.itemsList[item])

        self.move(pos)
        self.show()

        self.ajustWidth()
        self.ajustPos()

        self.setFocus()
        self.activateWindow() class GraphicalIDE(Code2Blocks):

    #----------------------------------------------------------------------
    def __init__(self, ide):

        self.main = ide.main
        self.ide = ide

        self.highlightedRect = QtCore.QRect()
        self.inPlace = 0
        self.posY = 20
        self.openID = 1

        self.fileName = None

        self.listBlocks = []
        #self.listSpaces = 0

        self.setup_bloques()

        self.main.tabWidget_files.setCurrentIndex(0)
        self.main.tabWidget_files.setMaximumSize(10000, 10e6)

        widget = self.get_widget("Pinguino")
        self.main.stackedWidget_blocks.setCurrentWidget(widget)

        self.constant_update()
        self.constant_auto_raise()


    # #----------------------------------------------------------------------
    # def set_tab(self, tab_name):
        # for index in range(self.main.tabWidget_blocks.count()):
            # if self.main.tabWidget_blocks.tabText(index) == tab_name:
                # self.main.tabWidget_blocks.setCurrentIndex(index)
                # break


    #----------------------------------------------------------------------
    def ide_new_file(self, *args, **kwargs):
        path = kwargs.get("filename", self.ide.get_untitled_name(ext=".gpde"))
        filename = os.path.split(path)[1]

        editor = QtWidgets.QWidget()
        widget = Ui_Form_graphical()
        widget.setupUi(editor)

        widget.widget.setMinimumSize(QtCore.QSize(2000, 2000))

        main_widget = widget.widget

        scroll_area = widget.scrollArea

        editor.scroll_area = widget.scrollArea

        area = WorkArea(parent=main_widget,
                        scroll=scroll_area,
                        #widget=widget,
                        frame=self,
                        ide=self.ide)

        editor.graphical_area = area

        self.main.tabWidget_files.addTab(editor, filename)

        editor.keyPressEvent = self.__keyPressEvent__

        self.main.tabWidget_files.setCurrentWidget(editor)
        index = self.main.tabWidget_files.currentIndex()
        self.main.tabWidget_files.setTabText(index, filename[:-1])
        self.ide.update_actions()


    #----------------------------------------------------------------------
    def __keyPressEvent__(self, event):
        editor = self.main.tabWidget_files.currentWidget()
        #editor.graphical_area

        if not editor.graphical_area.SelectArea.isVisible(): return

        if event.key() == QtCore.Qt.Key_Delete:
            editor.graphical_area.dele_blocks()


    # #----------------------------------------------------------------------
    # def ide_tab_changed(self, *args, **kwargs):
        # self.main.tabWidget_files.setVisible(self.main.tabWidget_files.count() > 0)
        # self.main.frame_logo.setVisible(not self.main.tabWidget_files.count() > 0)
        # self.main.actionClose_file.setEnabled(self.main.tabWidget_files.count() > 0)

        # editor = self.main.tabWidget_files.currentWidget()
        # if getattr(editor, "path", None): self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+editor.path)
        # else: self.ide.setWindowTitle(os.getenv("PINGUINO_NAME"))

        # index = self.main.tabWidget_files.currentIndex()
        # filename = self.main.tabWidget_files.tabText(index)
        # if filename.endswith("*"): self.main.actionSave_file.setEnabled(True)
        # else: self.main.actionSave_file.setDisabled(True)

        # self.ide.__update_current_dir_on_files__()


    #----------------------------------------------------------------------
    def ide_save_file(self, *args, **kwargs):

        editor = kwargs.get("editor", None)
        if not editor: editor = self.ide.get_tab().currentWidget()
        index = self.ide.get_tab().indexOf(editor)
        #editor = self.main.tabWidget_files.currentWidget()
        #index = self.main.tabWidget_files.currentIndex()
        filename = self.main.tabWidget_files.tabText(index)
        save_path = getattr(editor, "path", None)

        if not save_path:
            save_path, filename = Dialogs.set_save_file(self.ide, filename)
            if not save_path: return False
            setattr(editor, "path", save_path)
            self.main.tabWidget_files.setTabText(index, filename)
            self.main.tabWidget_files.setTabToolTip(index, save_path)
            self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+save_path)



        self.__save_file__(editor=editor)
        return True


    #----------------------------------------------------------------------
    def ide_save_as(self, *args, **kwargs):

        editor = kwargs.get("editor", None)
        if not editor: editor = self.ide.get_tab().currentWidget()
        index = self.ide.get_tab().indexOf(editor)
        #editor = self.main.tabWidget_files.currentWidget()
        #index = self.main.tabWidget_files.currentIndex()
        filename = self.main.tabWidget_files.tabText(index)
        save_path = getattr(editor, "path", None)

        save_path, filename = Dialogs.set_save_file(self.ide, filename)
        if not save_path: return False
        setattr(editor, "path", save_path)
        self.main.tabWidget_files.setTabText(index, filename)
        self.main.tabWidget_files.setTabToolTip(index, save_path)
        self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+save_path)

        self.__save_file__(editor=editor)
        return True



    #----------------------------------------------------------------------
    @Decorator.requiere_open_files()
    def get_pinguino_source_code(self):

        editor = self.main.tabWidget_files.currentWidget()
        #editor.graphical_area.update_code()
        return editor.graphical_area.update_code()


    #----------------------------------------------------------------------
    def __save_file__(self, *args, **kwargs):

        editor = kwargs.get("editor", self.ide.get_tab())
        content = self.get_gpde(editor)
        self.save_raw_parser(content, editor.path)

        # setattr(editor, "last_saved", content)
        # self.ide.ide_remove_backup_file(editor=editor)

        self.ide.editor_saved()



    #----------------------------------------------------------------------
    def save_raw_parser(self, content, filename):

        file_parser = RawConfigParser()
        count = 0
        for block in content:
            count += 1
            name_section = "Block-%d"%count
            file_parser.add_section(name_section)
            for key in block.keys():
                file_parser.set(name_section, key, block[key])
        file_parser.write(codecs.open(filename, "w", encoding="utf-8"))


    #----------------------------------------------------------------------
    def read_raw_parser(self, filename):

        blocks_set = []
        file_parser = RawConfigParser()

        if os.getenv("PINGUINO_PYTHON") is "2":
            if type(filename) in [str, unicode]: file_parser.readfp(codecs.open(filename, "r", encoding="utf-8"))
            else: file_parser = filename
        elif os.getenv("PINGUINO_PYTHON") is "3":
            if type(filename) == str: file_parser.readfp(codecs.open(filename, "r", encoding="utf-8"))
            else: file_parser = filename

        sections = file_parser.sections()
        for section in sections:
            options = file_parser.options(section)
            block = {}
            for option in options:
                file_parser.get(section, option)
                value = file_parser.get(section, option)

                if os.getenv("PINGUINO_PYTHON") is "2":
                    if (type(value) in [str, unicode]) and (value[0] in ["[", "("]):
                        block[option] = eval(file_parser.get(section, option))
                    else:
                        block[option] = file_parser.get(section, option)
                elif os.getenv("PINGUINO_PYTHON") is "3":
                    if (type(value) == str) and (value[0] in ["[", "("]):
                        block[option] = eval(file_parser.get(section, option))
                    else:
                        block[option] = file_parser.get(section, option)

            blocks_set.append(block)
        return blocks_set


    #----------------------------------------------------------------------
    def get_gpde(self, editor=None):

        if editor is None:
            editor = self.main.tabWidget_files.currentWidget()

        blocks = editor.graphical_area.get_project_blocks()

        to_save = []
        for block in blocks:
            to_save.append({
                "basename": block.metadata.basename,
                "position": (block.metadata.pos_.x(), block.metadata.pos_.y()),
                #"position": (block.pos().x(), block.pos().y()),
                "constructor": block.metadata.get_contructor(),
                "name": block.metadata.name,
                "self_id": self.serialize_widgets([block])[0],
                "to": self.serialize_widgets(block.metadata.to),
                "from": self.serialize_widgets(block.metadata.from_),
                #"inside2": self.serialize_widgets(block.metadata.inside),
                "inside": self.serialize_widgets(self.sort_inside(block)),
                "nested": self.serialize_widgets(block.metadata.nested),
                })

        return to_save


    #----------------------------------------------------------------------
    def sort_inside(self, block):

        layout = block.metadata.object_.layout
        if layout is None: return []
        #bloque = block.ARGS[2:]
        #layout_pos = []
        #empty = block.metadata.object_.get_layout_pos_save()
        #fix = 0
        #for i in range(len(bloque)):
            #if bloque[i] in [["space"], ["space_bool"]]:
                #if i in empty:
                    #layout_pos.append(None)
                #else:
                    #layout_pos.append(True)
                    #fix += 1
                    #empty = map(lambda x:x-fix, empty)

        layout_pos = block.metadata.object_.get_layout_pos_save()

        widgets = []
        for i in range(layout.count()):
            widgets.append(layout.itemAt(i).widget())

        widgets = list(filter(lambda wdg:getattr(wdg, "metadata", False), widgets))

        inside = layout_pos[:]

        if inside.count(True) == len(widgets):
            for i in range(len(inside)):
                if inside[i]: inside[i] = widgets.pop(0)
        else:
            raise Exception("¬¬")

        return inside




    ##----------------------------------------------------------------------
    #def force_inside(self, block, inside):
        #



    #----------------------------------------------------------------------
    def serialize_widgets(self, widgets):

        ser = []
        for widget in widgets:
            #name = widget.__str__()
            if not widget:
                id_ = None
            else:
                id_ = re.findall("[.]*0x[\dabcdefABCDEF]*[.]*", widget.__str__())[0]
            ser.append(id_)
        return ser



    #----------------------------------------------------------------------
    def ide_open_files(self, *args, **kwargs):

        #filenames = Dialogs.set_open_file(self.ide, ".gpde")
        #for filename in filenames:

        filename = kwargs["filename"]

        if self.ide.ide_check_duplicate_file(filename): return

        self.ide_new_file(filename)
        editor = self.main.tabWidget_files.currentWidget()
        set_blocks = self.read_raw_parser(filename)
        self.load_blocks(set_blocks)
        self.main.tabWidget_files.setTabToolTip(self.main.tabWidget_files.currentIndex(), filename)
        self.main.tabWidget_files.setTabText(self.main.tabWidget_files.currentIndex(), os.path.split(filename)[1])
        self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+filename)
        setattr(editor, "path", filename)

        # self.ide.ide_tab_changed()

    #----------------------------------------------------------------------
    def load_blocks(self, set_blocks):

        editor = self.main.tabWidget_files.currentWidget()
        editor.graphical_area.isOpening = True

        toFitInside = []
        #restaurPos = []
        #all_icons = []

        #dummy, pos = editor.graphical_area.new_bloq("output", all_sets["convert_"], QtCore.QPoint(), "dummy_block", "dummy_block")
        #dummy.metadata.self_id = self.serialize_widgets([dummy])[0]

        for block in set_blocks:
            name = block["name"]
            args = ["", ""] + block["constructor"]
            pos = QtCore.QPoint(*block["position"])
            basename = block["basename"]
            ID = block["self_id"]

            newIcon = editor.graphical_area.new_bloq(name, args, pos, basename)[0]
            newIcon.metadata.self_id = ID

            newIcon.move(pos)
            newIcon.setCursor(QtGui.QCursor(OPENHANDCURSOR))

            newIcon.metadata.to = block["to"]
            newIcon.metadata.from_ = block["from"]
            newIcon.metadata.inside = block["inside"]
            #for i in range(newIcon.metadata.inside.count(None)):
                #newIcon.metadata.inside.remove(None)
            newIcon.metadata.nested = block["nested"]

        self.replace_id_by_widgets()

        for block in editor.graphical_area.get_project_blocks():
            if block.metadata.inside:
                toFitInside.append([block, block.metadata.inside[:]])
                #self.force_inside(block, block.metadata.inside)

        all_dummies = []
        for parent, toFit in toFitInside:
            for ins in toFit:
                wdg = self.get_widget_from_id(ins)
                if wdg:
                    wdg.metadata.add_parent([parent, wdg], force=True)
                else:
                    dummy, pos = editor.graphical_area.new_bloq("output", all_sets["convert_"], QtCore.QPoint(), "dummy_block", "dummy_block")
                    dummy.metadata.self_id = self.serialize_widgets([dummy])[0]
                    dummy.metadata.add_parent([parent, dummy], force=True)
                    all_dummies.append(dummy)
                    #dummy.

        for dummy in all_dummies:
            dummy.metadata.remove_parent()
            dummy.metadata.destroy_this()


        #for block in editor.graphical_area.get_project_blocks():
            #if block.metadata.type_ in "tipo9 tipo7".split(): block.lower()

        #for block in editor.graphical_area.get_project_blocks():
            #if block.metadata.type_ in "tipo4".split(): block.lower()





    #----------------------------------------------------------------------
    def replace_id_by_widgets(self):

        editor = self.main.tabWidget_files.currentWidget()
        for block in editor.graphical_area.get_project_blocks():
            block.metadata.to = list(map(self.get_widget_from_id, block.metadata.to))
            block.metadata.from_ = list(map(self.get_widget_from_id, block.metadata.from_))
            block.metadata.inside = list(map(self.get_widget_from_id, block.metadata.inside))
            block.metadata.nested = list(map(self.get_widget_from_id, block.metadata.nested))


    #----------------------------------------------------------------------
    def get_widget_from_id(self, id_):

        if type(id_) != type(""): return id_
        if id_ is None: return id_

        editor = self.main.tabWidget_files.currentWidget()
        blocks = editor.graphical_area.get_project_blocks()

        for block in blocks:
            if block.metadata.self_id == id_:
                return block


    #----------------------------------------------------------------------
    def ide_open_file_from_path(self, *args, **kwargs):

        filename = kwargs["filename"]

        if self.ide.ide_check_duplicate_file(filename): return
        self.ide_new_file(filename)
        editor = self.main.tabWidget_files.currentWidget()
        set_blocks = self.read_raw_parser(filename)
        self.load_blocks(set_blocks)

        editor = self.main.tabWidget_files.currentWidget()
        #index = self.main.tabWidget_files.currentIndex()
        #self.main.tabWidget_files.setTabText(index, os.path.split(filename)[1])
        #self.main.tabWidget_files.setTabToolTip(index, filename)
        editor.path = filename
        setattr(editor, "path", filename)
        self.main.tabWidget_files.setTabToolTip(self.main.tabWidget_files.currentIndex(), filename)
        self.main.tabWidget_files.setTabText(self.main.tabWidget_files.currentIndex(), os.path.split(filename)[1])
        self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+filename)

        # self.ide.ide_tab_changed()


    #----------------------------------------------------------------------
    def open_from_source(self, source):
        """"""
        filename = self.ide.get_untitled_name(ext=".gpde")

        self.ide_new_file(filename)
        editor = self.main.tabWidget_files.currentWidget()
        set_blocks = self.read_raw_parser(source)
        self.load_blocks(set_blocks)

        editor = self.main.tabWidget_files.currentWidget()
        editor.path = filename
        setattr(editor, "path", filename)
        self.main.tabWidget_files.setTabToolTip(self.main.tabWidget_files.currentIndex(), filename)
        self.main.tabWidget_files.setTabText(self.main.tabWidget_files.currentIndex(), os.path.split(filename)[1])
        self.ide.setWindowTitle(os.getenv("PINGUINO_NAME")+" - "+filename)

        # self.ide.ide_tab_changed()

        self.init_positions()


    #----------------------------------------------------------------------
    def init_positions(self):
        """"""
        editor = self.main.tabWidget_files.currentWidget()
        for block in editor.graphical_area.get_project_blocks():
            if block.metadata.from_:

                if block.metadata.name in ["output"]: continue

                if editor.graphical_area.get_type_magnetic(block, block.metadata.from_[0]):
                    pos = editor.graphical_area.get_type_magnetic(block, block.metadata.from_[0])[0][0]
                    block.move(pos)




    ##----------------------------------------------------------------------
    #def save_as_pde(self):

        #editor = self.main.tabWidget_files.currentWidget()
        #filename = editor.path.replace(".gpde", ".pde")
        #file_pde = codecs.open(filename, "w", encoding="utf-8")
        #file_pde.write(self.get_pinguino_source_code())
        #file_pde.close()


    #----------------------------------------------------------------------
    @Decorator.requiere_graphical_mode()
    def get_work_area(self):
        return self.main.tabWidget_files.currentWidget().graphical_area


    #----------------------------------------------------------------------
    def setup_bloques(self):
        self.StartBlocks = all_sets.copy()
        self.allTabs = {}

        self.build_block_tabs()

        self.main.comboBox_blocks.addItems(self.get_block_tabs())

        for tab in self.get_block_tabs():
            tab_set = []

            for key in all_sets.keys():
                if all_sets[key][1] == tab:
                    tab_set.append([key, all_sets[key]])

            self.add_blocks(tab, tab_set)


    #----------------------------------------------------------------------
    def get_tab_set(self, tab_name):
        tab_set = []
        for key in all_sets.keys():
            if all_sets[key][1] == tab_name:
                tab_set.append([key, all_sets[key]])
        return tab_set


    #----------------------------------------------------------------------
    def get_block_tabs(self):
        tabs = ["Search"]
        for key in all_sets.keys(): tabs.append(all_sets[key][1])
        tabs = list(set(tabs))
        tabs.remove("None")
        return tabs


    #----------------------------------------------------------------------
    def build_block_tabs(self, tabs=None):
        if tabs is None: tabs = self.get_block_tabs()
        for tab in tabs:
            widget = QtWidgets.QWidget()

            ui = Ui_widgetBlock()
            ui.setupUi(widget)

            tool_area = ToolArea(ui.scrollArea, self.get_work_area, self.ide)
            ui.gridLayout_2.addWidget(tool_area, 0, 0, 1, 1)

            # self.main.tabWidget_blocks.addTab(widget, tab)
            widget.setObjectName(tab)
            self.main.stackedWidget_blocks.addWidget(widget)

            ui.gridLayout_2.setContentsMargins(9, 9, 9, 9)
            ui.gridLayout_2.setSpacing(10)
            widget.grid_layout = ui.gridLayout_2
            widget.tool_area = tool_area
            tool_area.widget_parent = widget
            tool_area.scroll_area = ui.scrollArea

            #palette = QtGui.QPalette(self.main.centralwidget.parent().palette())
            #widget.setAutoFillBackground(True)
            #palette.setColor(QtGui.QPalette.Window, QtGui.QColor("#ffffff"))
            #widget.setPalette(palette)

            ui.frame.setStyleSheet("""

            QFrame{
                 background-color: #FFF;
             }

            """)

            ui.frame_2.setStyleSheet("""

            QFrame{
                 background-color: #FFF;
             }

            """)

            ui.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame)

            widget.mousePressEvent = tool_area.mouse_press_event
            widget.mouseMoveEvent = tool_area.mouse_move_event
            widget.mouseReleaseEvent = tool_area.mouse_release_event
            widget.content_widgets = []

    # #----------------------------------------------------------------------
    # def remove_tab(self, tab_name):
        # for index in range(self.main.tabWidget_blocks.count()):
            # if self.main.tabWidget_blocks.tabText(index) == tab_name:
                # self.main.tabWidget_blocks.removeTab(index)
                # break

    #----------------------------------------------------------------------
    def get_widget(self, tab_name):
        # for index in range(self.main.tabWidget_blocks.count()):
            # if self.main.tabWidget_blocks.tabText(index) == tab_name:
                # widget = self.main.tabWidget_blocks.widget(index)
                # return widget

        for index in range(self.main.stackedWidget_blocks.count()):
            # self.main.stackedWidget_blocks
            widget = self.main.stackedWidget_blocks.widget(index)
            if widget.objectName() == tab_name:
                return widget


    #----------------------------------------------------------------------
    def add_blocks(self, tab, tab_set, count=0, side=0, clear=False):
        widget = self.get_widget(tab)
        grid_layout = widget.grid_layout
        tool_area = widget.tool_area

        if clear: self.clear_area(tab)


        for key, tab in tab_set:

            newIcon = QtWidgets.QWidget(tool_area)
            eval(Blocks[tab[0]])(newIcon, tab[2:])
            newIcon.setMaximumSize(newIcon.size())

            widget.content_widgets.append(newIcon)

            newIcon.NAME = tab[0]
            newIcon.ARGS = tab
            newIcon.BASENAME = key

            grid_layout.addWidget(newIcon, count, side, 1, 1)
            count += 1




    # #----------------------------------------------------------------------
    # def add_blocks2(self, tab, tab_set):
        # # widget = self.get_widget(tab)
        # # grid_layout = widget.grid_layout
        # # tool_area = widget.tool_area

        # # if clear: self.clear_area(tab)

        # count = 0

        # for key, tab in tab_set:

            # area = self.ide.get_current_editor().graphical_area

            # newIcon = QtWidgets.QWidget(area)
            # eval(Blocks[tab[0]])(newIcon, tab[2:])
            # newIcon.setMaximumSize(newIcon.size())

            # # widget.content_widgets.append(newIcon)

            # newIcon.NAME = tab[0]
            # newIcon.ARGS = tab
            # newIcon.BASENAME = key

            # newIcon.move(10, 10)

            # # area.addWidget(newIcon, count, 0, 1, 1)
            # count += 1




    #----------------------------------------------------------------------
    def add_group_blocks(self, name, new_set):
        tab_set = self.get_tab_set(name)
        new_set = list(map(lambda x: [x[0], x[2]], new_set))
        self.add_blocks(name, tab_set + new_set)


    #----------------------------------------------------------------------
    def clear_area(self, area):

        widget = self.get_widget(area)

        for wid in widget.content_widgets:
            wid.deleteLater()
            widget.content_widgets.remove(wid)



    #----------------------------------------------------------------------
    def get_tab(self):

        return self.ide.get_tab()

    #----------------------------------------------------------------------
    def isActiveWindow(self):

        return self.ide.isActiveWindow()

    #----------------------------------------------------------------------
    def is_graphical(self):

        return self.ide.is_graphical()

    #----------------------------------------------------------------------
    def is_widget(self):
        """"""
        return self.ide.is_widget()



    #----------------------------------------------------------------------
    @Decorator.timer(50)
    @Decorator.requiere_open_files()
    @Decorator.requiere_graphical_mode()
    @Decorator.requiere_main_focus()
    def constant_update(self):
        if self.ide.is_graphical() is True:
            editor = self.main.tabWidget_files.currentWidget()
            editor.graphical_area.constant_update()


    #----------------------------------------------------------------------
    @Decorator.timer(500)
    @Decorator.requiere_open_files()
    @Decorator.requiere_graphical_mode()
    @Decorator.requiere_main_focus()
    def constant_auto_raise(self):

        editor = self.main.tabWidget_files.currentWidget()
        if not editor.graphical_area.isDragging:
            editor.graphical_area.auto_raise()


    #----------------------------------------------------------------------
    def update_blocks_search_tab(self, text):

        if len(text) < 2: return
        if text == QtWidgets.QApplication.translate("Frame", "Search Block..."): return
        if not text: return
        bloques = []
        exclude = []
        for key in all_sets.keys():
            if all_sets[key][2][0] in ["label", "decorator"]:
                label = all_sets[key][2][1]
                if label.lower().startswith(text.lower()):
                    bloques.append([key, all_sets[key]])
                    exclude.append(all_sets[key][2][1])

        bloques.extend(self.get_blocks_for_library(text.lower(), exclude))

        if not bloques: return

        self.clear_area("Search")
        self.add_blocks("Search", bloques)
        self.ide.set_block_tab("Search")


    #----------------------------------------------------------------------
    def get_all_sets(self):

        return all_sets


    #----------------------------------------------------------------------
    def get_blocks_for_library(self, text, exclude):
        """"""
        if not hasattr(self.ide, "assistant"): self.ide.set_assistant()

        blocks = []
        for item in self.ide.assistant:
            function = self.ide.assistant[item]
            if not item.lower().startswith(text): continue
            if item in exclude: continue

            if function["return"] == "void":
                block = BlocksConstructor.Linear

            elif function["return"] == "bool":
                block = BlocksConstructor.OutputBool

            else:
                block = BlocksConstructor.Output

            linecode = "{}({});".format(item, function["args"])
            blocks.append([item, self.get_contructor(block, linecode)])

        return blocks     def makedirs(name, mode=0o777, exist_ok=False):
    def __init__(self):
    def compile_file(self, file_path):
    def compile_string(self, code, tmp_filename="temp_filename.pde", filenames=[]):
    def upload(self):
    def set_icsp(self):
    def set_8bit_compiler(self, compiler):
    def compiled(self):
    def get_errors(self):
    def get_errors_linking(self):
    def get_errors_compiling_c(self):
    def get_errors_compiling_asm(self):
    def get_result(self):
    def get_hex(self):
class Pinguino(PinguinoTools):
        NO_UPLOADED_KEY_TEXT = ["Pinguino not found",
                                "Error",
                                "Upload not possible",
                                "No target found",
                                "Resource busy",
                                "Entity not found",
                                ] class PinguinoConfig(object):

    #----------------------------------------------------------------------
    @classmethod
    def set_environ_vars(cls):
        """Configure some environ variables about OS and architecture.
        """

        #if not os.path.exists(os.path.join(os.getenv("PINGUINO_LIB"), "paths.cfg")):
            #logging.error("Missing: "+os.path.join(os.getenv("PINGUINO_LIB"), "paths.cfg"))
            #sys.exit()

        #config_paths = RawConfigParser()
        #config_paths.readfp(open(os.path.join(os.getenv("PINGUINO_LIB"), "paths.cfg"), "r")


        #RB20141116 : get the “bitness” of the current OS
        bitness, linkage = platform.architecture()
        os.environ["PINGUINO_OS_ARCH"] = bitness

        if os.name == "posix": #GNU/Linux
            os.environ["PINGUINO_OS_NAME"] = "linux"

        #Mac could return posix :/
        elif os.name == "os2":  #Mac OS X
            os.environ["PINGUINO_OS_NAME"] = "macosx"

        elif os.name == "nt":  #Windows
            os.environ["PINGUINO_OS_NAME"] = "windows"

        config_paths = RawConfigParser()
        config_paths.readfp(open(os.path.join(os.getenv("PINGUINO_LIB"), "qtgui", "config", "pinguino.{PINGUINO_OS_NAME}.conf".format(**os.environ)), "r"))

        #load path from paths.conf
        os.environ["PINGUINO_USER_PATH"] = os.path.expandvars(os.path.expanduser(config_paths.get("Paths", "user_path")))
        os.environ["PINGUINO_INSTALL_PATH"] = os.path.expandvars(os.path.expanduser(config_paths.get("Paths", "install_path")))
        os.environ["PINGUINO_USERLIBS_PATH"] = os.path.expandvars(os.path.expanduser(config_paths.get("Paths", "user_libs")))

        os.environ["PINGUINO_LIBS_PATH"] = os.path.expandvars(os.path.expanduser(os.path.dirname(config_paths.get("Paths", "pinguino_8_libs"))))

        os.environ["PINGUINO_8_LIBS_PATH"] = os.path.expandvars(os.path.expanduser(config_paths.get("Paths", "pinguino_8_libs")))
        os.environ["PINGUINO_32_LIBS_PATH"] = os.path.expandvars(os.path.expanduser(config_paths.get("Paths", "pinguino_32_libs")))

        # os.environ["PINGUINO_USERLIBS_PATH"] = os.path.expandvars(os.path.join(os.getenv("PINGUINO_USER_PATH"), "libraries"))
        os.environ["PINGUINO_DEFAULT_FILES"] = os.path.join(os.getenv("PINGUINO_USER_PATH"), "local")


    #----------------------------------------------------------------------
    @classmethod
    def check_user_files(cls):
        """Check existence of depends directories and created if missed."""

        #check instalation path
        if not os.path.exists(os.getenv("PINGUINO_INSTALL_PATH")):
            logging.warning("Missing Pinguino libraries instalation. "
                            "Make sure the paths in %s are correct."%os.path.join(os.getenv("PINGUINO_LIB"), "paths.conf"))

        #create ~/.pinguino
        if not os.path.exists(os.getenv("PINGUINO_USER_PATH")):
            makedirs(os.getenv("PINGUINO_USER_PATH"), exist_ok=True)
                
        #create ~/.pinguino/user
        if not os.path.exists(os.getenv("PINGUINO_DEFAULT_FILES")):
            makedirs(os.getenv("PINGUINO_DEFAULT_FILES"), exist_ok=True)
                
        #Check files and directories
        cls.check_locations()


    #----------------------------------------------------------------------
    @classmethod
    def check_locations(cls):
        """If not exist some directory then copy them from installation path."""

        cls.if_not_exist_then_copy(src=os.path.join(os.getenv("PINGUINO_LIBS_PATH"), "examples"),
                                   dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "examples"))

        cls.if_not_exist_then_copy(src=os.path.join(os.getenv("PINGUINO_LIBS_PATH"), "graphical_examples"),
                                   dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "graphical_examples"))

        cls.if_not_exist_then_copy(src=os.path.join(os.getenv("PINGUINO_LIBS_PATH"), "source"),
                                   dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "source"))

        cls.if_not_exist_then_copy(src=os.path.join(os.getenv("PINGUINO_INSTALL_PATH"), "p32", "obj"),
                                   dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "source", "obj"))

        cls.if_not_exist_then_copy(src=os.path.join(os.getenv("PINGUINO_LIB"), "qtgui", "config", "pinguino.%s.conf"%os.getenv("PINGUINO_OS_NAME")),
                                   dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "pinguino.conf"))


        if os.path.exists(os.getenv("PINGUINO_USERLIBS_PATH")):
            for lib in os.listdir(os.getenv("PINGUINO_USERLIBS_PATH")):
                src = os.path.join(os.getenv("PINGUINO_USERLIBS_PATH"), lib, "examples")
                if os.path.exists(src):
                    cls.if_not_exist_then_copy(src=src,
                                               dst=os.path.join(os.getenv("PINGUINO_USER_PATH"), "examples_libs", lib))


    #----------------------------------------------------------------------
    @classmethod
    def if_not_exist_then_copy(cls, src, dst):
        """The method name say all.

        Parameters
        ----------
        src: str
            Source file or directory.

        dst: str
            Destiny file or directory.
        """
        if not os.path.exists(src):
            return


        #When src is a file
        if os.path.isfile(src):
            if not os.path.exists(src): logging.warning("Missing: " + src)
            else:
                if not os.path.exists(dst): shutil.copy(src, dst)
            return

        #Create parent directories
        def prepare_directory(file_path):
            dir_, filename = os.path.split(file_path)
            all_dirs = []
            while not os.path.exists(dir_):
                all_dirs.append(dir_)
                dir_, dir2 = os.path.split(dir_)
            all_dirs.reverse()
            for dir_ in all_dirs: makedirs(dir_, exist_ok=True)

        #When src is a directory, copy file by file
        all_files = []
        for path, dirs, files in os.walk(src):
            for f in files:
                file_path_src = os.path.join(path, f)
                file_path_dst = dst + os.path.join(path, f).replace(src, "")

                if not os.path.exists(file_path_dst):
                    logging.warning("Copying: " + file_path_dst)
                    prepare_directory(file_path_dst)
                    shutil.copy(file_path_src, file_path_dst)


    #----------------------------------------------------------------------
    @classmethod
    def update_pinguino_extra_options(self, config, pinguino_object):
        """Load on Pinguino Object the advance configuration for 32 bit.

        Parameters
        ----------
        config: RawConfigParser
            Config file.
        pinguino_object: Pinguino()
            Pinguino
        """

        pinguino_object.MIPS16 = str(config.config("Board", "mips16", True)).lower()
        pinguino_object.HEAPSIZE = str(config.config("Board", "heapsize", 512))
        pinguino_object.OPTIMIZATION = config.config("Board", "optimization", "-O3")


    #----------------------------------------------------------------------
    @classmethod
    def update_pinguino_paths(cls, config, pinguino_object, prefix=None, workspace=None):
        """Load paths of libraries and compilers.

        Parameters
        ----------
        config: RawConfigParser
            Config file.
        pinguino_object: Pinguino()
            Pinguino
        prefix: str, optional
            Path for search libraries and compilers, default is absolute path from root.
        workspace: str,optional
            Path for makefiles and temp files, default is ~/.pinguino/source

        """

        user_sdcc_bin = config.get_path("sdcc_bin", prefix)
        if user_sdcc_bin: pinguino_object.P8_SDCC_BIN = user_sdcc_bin
        #else: logging.warning("Missing path to 'sdcc_bin': '%s'"%user_sdcc_bin)

        user_sdcc_bin = config.get_path("xc8_bin", prefix)
        if user_sdcc_bin: pinguino_object.P8_XC8_BIN = user_sdcc_bin
        #else: logging.warning("Missing path to 'xc8_bin': '%s'"%user_sdcc_bin)

        user_gcc_bin = config.get_path("gcc_bin", prefix)
        if user_gcc_bin: pinguino_object.P32_GCC_BIN = user_gcc_bin
        #else: logging.warning("Missing path to 'gcc_bin': '%s'"%user_gcc_bin)

        if workspace:
            pinguino_object.SOURCE_DIR = workspace
        else:
            pinguino_source = os.path.join(os.getenv("PINGUINO_USER_PATH"), "source")
            #pinguino_source = os.path.join(os.path.dirname(os.getenv("PINGUINO_8_LIBS_PATH")), "source")
            if pinguino_source: pinguino_object.SOURCE_DIR = pinguino_source
            else: logging.warning("Missing path to 'source': '%s'"%pinguino_source)

        pinguino_8_libs = config.get_path("pinguino_8_libs", prefix)
        if pinguino_8_libs: pinguino_object.P8_DIR = pinguino_8_libs
        else: logging.warning("Missing path to '8_libs': '%s'"%pinguino_8_libs)

        pinguino_32_libs = config.get_path("pinguino_32_libs", prefix)
        if pinguino_32_libs: pinguino_object.P32_DIR = pinguino_32_libs
        else: logging.warning("Missing path to '32_libs': '%s'"%pinguino_32_libs)


    #----------------------------------------------------------------------
    @classmethod
    def update_user_libs(cls, pinguino_object, p8=[], p32=[], pdl=[]):
        """Reload paths for user installed libraries.

        Parameters
        ----------
        pinguino_object: Pinguino()
            Pinguino
        """

        pinguino_object.USER_P8_LIBS = cls.get_p8_libraries() + p8
        pinguino_object.USER_P32_LIBS = cls.get_p32_libraries() + p32
        pinguino_object.USER_PDL = cls.get_pdl_libraries() + pdl


    #----------------------------------------------------------------------
    @classmethod
    def get_p8_libraries(cls):
        """
        This is path where are .c files.

        """
        p8_libs = []
        if os.path.exists(os.getenv("PINGUINO_USERLIBS_PATH")):
            for lib in os.listdir(os.getenv("PINGUINO_USERLIBS_PATH")):
                p8 = os.path.join(os.getenv("PINGUINO_USERLIBS_PATH"), lib, "p8")
                if os.path.exists(p8):
                    p8_libs.append(p8)

        os_name = os.getenv("PINGUINO_OS_NAME")
        if os.getenv("PINGUINO_P8", False):
            if os_name == "windows":
                p8_libs.extend(os.getenv("PINGUINO_P8").split(";"))
            elif os_name == "linux":
                p8_libs.extend(os.getenv("PINGUINO_P8").split(":"))
            #FIXME_OSX
            # elif os_name == "macosx":
                # p32_libs.extend(os.getenv(PINGUINO_P32).aplit(":"))


        return p8_libs


    #----------------------------------------------------------------------
    @classmethod
    def get_p32_libraries(cls):
        """

        This is path where are .c files.

        """
        p32_libs = []
        if os.path.exists(os.getenv("PINGUINO_USERLIBS_PATH")):
            for lib in os.listdir(os.getenv("PINGUINO_USERLIBS_PATH")):
                p32 = os.path.join(os.getenv("PINGUINO_USERLIBS_PATH"), lib, "p32")
                if os.path.exists(p32):
                    p32_libs.append(p32)

        os_name = os.getenv("PINGUINO_OS_NAME")
        if os.getenv("PINGUINO_P32", False):
            if os_name == "windows":
                p32_libs.extend(os.getenv("PINGUINO_P32").split(";"))
            elif os_name == "linux":
                p32_libs.extend(os.getenv("PINGUINO_P32").split(":"))
            #FIXME_OSX
            # elif os_name == "macosx":
                # p32_libs.extend(os.getenv(PINGUINO_P32).aplit(":"))

        return p32_libs


    #----------------------------------------------------------------------
    @classmethod
    def get_pdl_libraries(cls):
        """

        This is individual paths for each .pdl or pdl32.

        """

        pdl_libs = []
        if os.path.exists(os.getenv("PINGUINO_USERLIBS_PATH")):
            for lib in os.listdir(os.getenv("PINGUINO_USERLIBS_PATH")):
                pdls = os.path.join(os.getenv("PINGUINO_USERLIBS_PATH"), lib, "pdl")
                if os.path.exists(pdls):
                    for pdl in os.listdir(pdls):
                        if pdl.endswith(".pdl") or pdl.endswith(".pdl32"):
                            pdl_libs.append(os.path.join(os.getenv("PINGUINO_USERLIBS_PATH"), lib, "pdl", pdl))

        os_name = os.getenv("PINGUINO_OS_NAME")
        if os.getenv("PINGUINO_PDL", False):
            if os_name == "windows":
                pdl_libs.extend(os.getenv("PINGUINO_PDL").split(";"))
            elif os_name == "linux":
                pdl_libs.extend(os.getenv("PINGUINO_PDL").split(":"))
            #FIXME_OSX
            # elif os_name == "macosx":
                # pdl_libs.extend(os.getenv(PINGUINO_P32).aplit(":"))


        return pdl_libs class Config(RawConfigParser, object):

    #----------------------------------------------------------------------
    def __init__(self):
        """RawConfigParser based.

        A set of sections and options for storage configurations.

        [SECTION1]
        option11 = value11
        option12 = value12

        [SECTION2]
        option21 = (0, 1, 2)
        option22 = 3
        option23 = False

        [SECTION3]
        option3 = value3
        """

        super(Config, self).__init__()

        self.ide_config_file = os.path.join(os.getenv("PINGUINO_USER_PATH"), "pinguino.conf")
        self.verify_config_file()
        self.load_config()


    #----------------------------------------------------------------------
    def get_format_config(self, section, option):
        """Return formated configuration option.

        Parameters
        ----------
        section: str
            Section name.
        option: str
            Option name.

        Returns
        -------
        value: str, float, bool
            Return corret data type.
        """

        value = self.get(section, option)
        if type(value) != type(""): return value

        if re.match("([-\d]+)$", value):
            return int(value)

        if re.match("([.\d*e-]+)$", value):
            return float(value)

        elif re.match("(true)$", value.lower()):
            return True

        elif re.match("(false)$", value.lower()):
            return False

        else: return value


    #----------------------------------------------------------------------
    def config(self, section, option, default):
        """Read option or return default.

        Parameters
        ----------
        section: str
            Section name.
        option: str
            Option name.
        default: str, float, bool

        Returns
        -------
        option: str, float, bool
            If option exist then return them, otherwise return default value.
        """

        if self.has_section(section) and self.has_option(section, option):
            return self.get_format_config(section, option)
        else:
            self.set(section, option, default)
            return default


    #----------------------------------------------------------------------
    def set(self, section, option, value):
        """save option value.

        Parameters
        ----------
        section: str
            Section name.
        option: str
            Option name.
        value: str
            Value for option.
        """

        if not self.has_section(section): self.add_section(section)
        super(Config, self).set(section, option, value)


    #----------------------------------------------------------------------
    def verify_config_file(self):
        """Check if exist configuration file. otherwise create it.
        """

        if not os.path.isfile(self.ide_config_file):
            open(self.ide_config_file, "w").close()


    #----------------------------------------------------------------------
    def save_config(self):
        """Write configuration on configuration file.
        """

        self.write(open(self.ide_config_file, "w"))


    #----------------------------------------------------------------------
    def load_config(self):
        """Read configuration from configuration file.
        """

        self.readfp(open(self.ide_config_file, "r"))


    #----------------------------------------------------------------------
    def get_path(self, name, prefix=None):
        """Get corret formated path from config.

        Parameters
        ----------
        name: str
            Option name from configuration file.
        prefix: str, optional
            Path to add before the getted from configuration file, default is original path.

        Returns
        -------
        path: str
            Absolute path.
        """

        paths = self.config("Features", "pathstouse", "Paths")

        if self.has_option(paths, name):
            if prefix:
                return os.path.normpath(os.path.join(prefix, self.get(paths, name)[1:]))
            else:
                return os.path.normpath(self.get(paths, name))
        else:
            logging.warning("Missing '{}' for 'Paths' or 'PathsCustom' in config file: '{}'".format(name, self.ide_config_file))
            return ""


    #----------------------------------------------------------------------
    def get_recents(self, section="Recents"):
        """Getter for recents files from configuration.

        Parameters
        ----------
        section: str, optional
            Section for search recents.

        Returns
        -------
        files: list
            A list of paths for recents files.
        """

        if not self.has_section(section): self.add_section(section)
        options = self.options(section)

        files = []
        for option in options:
            if option.startswith("recent_") and self.get(section, option):
                files.append(self.get(section, option))

        return files


    #----------------------------------------------------------------------
    def get_recents_open(self, section="Recents"):
        """Getter for recents opened files from configuration.

        Parameters
        ----------
        section: str, optional
            Section for search recents opened.

        Returns
        -------
        files: list
            A list of paths for recents opened files.
        """

        if not self.has_section(section): self.add_section(section)
        options = self.options(section)

        files = []
        for option in options:
            if option.startswith("open_") and self.get(section, option):
                files.append(self.get(section, option))

        return files


    #----------------------------------------------------------------------
    def clear_recents_open(self, section="Recents"):
        """Remove recents opened files from configuration.

        Parameters
        ----------
        section: str, optional
            Section for remove recents opened.
        """

        if not self.has_section(section): self.add_section(section)
        options = self.options(section)

        for option in options:
            if option.startswith("open_"):
                self.remove_option(section, option)


    #----------------------------------------------------------------------
    def clear_recents(self, section="Recents"):
        """Remove recents files from configuration.

        Parameters
        ----------
        section: str, optional
            Section for remove recents.
        """

        if not self.has_section(section): self.add_section(section)
        options = self.options(section)

        for option in options:
            if option.startswith("recent_"):
                self.remove_option(section, option) class Ui_PinguinoIDE(object):
    def setupUi(self, PinguinoIDE):
        PinguinoIDE.setObjectName("PinguinoIDE")
        PinguinoIDE.resize(1024, 768)
        PinguinoIDE.setWindowTitle("Pinguino 13")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/logo/art/windowIcon.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        PinguinoIDE.setWindowIcon(icon)
        PinguinoIDE.setDockOptions(QtWidgets.QMainWindow.AllowNestedDocks|QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks|QtWidgets.QMainWindow.ForceTabbedDocks)
        PinguinoIDE.setUnifiedTitleAndToolBarOnMac(True)
        self.centralwidget = QtWidgets.QWidget(PinguinoIDE)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_29 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_29.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_29.setSpacing(0)
        self.gridLayout_29.setObjectName("gridLayout_29")
        self.frame_logo = QtWidgets.QFrame(self.centralwidget)
        self.frame_logo.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_logo.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_logo.setObjectName("frame_logo")
        self.gridLayout = QtWidgets.QGridLayout(self.frame_logo)
        self.gridLayout.setObjectName("gridLayout")
        spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 1, 2, 1, 1)
        self.label_logo = QtWidgets.QLabel(self.frame_logo)
        self.label_logo.setText("")
        self.label_logo.setPixmap(QtGui.QPixmap(":/logo/art/banner_blue.png"))
        self.label_logo.setObjectName("label_logo")
        self.gridLayout.addWidget(self.label_logo, 1, 1, 1, 1)
        spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem1, 1, 0, 1, 1)
        self.gridLayout_29.addWidget(self.frame_logo, 1, 0, 1, 1)
        self.tabWidget_files = QtWidgets.QTabWidget(self.centralwidget)
        self.tabWidget_files.setTabsClosable(True)
        self.tabWidget_files.setMovable(True)
        self.tabWidget_files.setObjectName("tabWidget_files")
        self.gridLayout_29.addWidget(self.tabWidget_files, 0, 0, 1, 1)
        PinguinoIDE.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(PinguinoIDE)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1024, 21))
        self.menubar.setObjectName("menubar")
        self.menuFile = QtWidgets.QMenu(self.menubar)
        self.menuFile.setObjectName("menuFile")
        self.menuRecents = QtWidgets.QMenu(self.menuFile)
        self.menuRecents.setObjectName("menuRecents")
        self.menuEdit = QtWidgets.QMenu(self.menubar)
        self.menuEdit.setObjectName("menuEdit")
        self.menuPinguino = QtWidgets.QMenu(self.menubar)
        self.menuPinguino.setTitle("&Debug")
        self.menuPinguino.setObjectName("menuPinguino")
        self.menuHelp = QtWidgets.QMenu(self.menubar)
        self.menuHelp.setObjectName("menuHelp")
        self.menuLinks = QtWidgets.QMenu(self.menuHelp)
        self.menuLinks.setObjectName("menuLinks")
        self.menuGitHub = QtWidgets.QMenu(self.menuLinks)
        self.menuGitHub.setObjectName("menuGitHub")
        self.menuSource = QtWidgets.QMenu(self.menubar)
        self.menuSource.setObjectName("menuSource")
        self.menuSettings = QtWidgets.QMenu(self.menubar)
        self.menuSettings.setObjectName("menuSettings")
        self.menuIcons_theme = QtWidgets.QMenu(self.menuSettings)
        self.menuIcons_theme.setObjectName("menuIcons_theme")
        self.menuIcons_size = QtWidgets.QMenu(self.menuSettings)
        self.menuIcons_size.setObjectName("menuIcons_size")
        self.menuProject = QtWidgets.QMenu(self.menubar)
        self.menuProject.setObjectName("menuProject")
        self.menuRecentProjects = QtWidgets.QMenu(self.menuProject)
        self.menuRecentProjects.setObjectName("menuRecentProjects")
        self.menuTools = QtWidgets.QMenu(self.menubar)
        self.menuTools.setObjectName("menuTools")
        PinguinoIDE.setMenuBar(self.menubar)
        self.dockWidget_right = QtWidgets.QDockWidget(PinguinoIDE)
        self.dockWidget_right.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
        self.dockWidget_right.setAllowedAreas(QtCore.Qt.LeftDockWidgetArea|QtCore.Qt.RightDockWidgetArea)
        self.dockWidget_right.setObjectName("dockWidget_right")
        self.dockWidgetContents_rigth = QtWidgets.QWidget()
        self.dockWidgetContents_rigth.setObjectName("dockWidgetContents_rigth")
        self.gridLayout_15 = QtWidgets.QGridLayout(self.dockWidgetContents_rigth)
        self.gridLayout_15.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_15.setSpacing(0)
        self.gridLayout_15.setObjectName("gridLayout_15")
        self.tabWidget_tools = QtWidgets.QTabWidget(self.dockWidgetContents_rigth)
        self.tabWidget_tools.setAcceptDrops(True)
        self.tabWidget_tools.setTabPosition(QtWidgets.QTabWidget.West)
        self.tabWidget_tools.setMovable(True)
        self.tabWidget_tools.setObjectName("tabWidget_tools")
        self.Files = QtWidgets.QWidget()
        self.Files.setObjectName("Files")
        self.gridLayout_9 = QtWidgets.QGridLayout(self.Files)
        self.gridLayout_9.setObjectName("gridLayout_9")
        self.comboBox_files = QtWidgets.QComboBox(self.Files)
        self.comboBox_files.setObjectName("comboBox_files")
        self.comboBox_files.addItem("")
        self.comboBox_files.addItem("")
        self.comboBox_files.addItem("")
        self.comboBox_files.addItem("")
        self.gridLayout_9.addWidget(self.comboBox_files, 0, 0, 1, 1)
        self.treeWidget_explorer = QtWidgets.QTreeWidget(self.Files)
        self.treeWidget_explorer.setAnimated(True)
        self.treeWidget_explorer.setObjectName("treeWidget_explorer")
        self.treeWidget_explorer.headerItem().setText(0, "1")
        self.treeWidget_explorer.header().setVisible(False)
        self.gridLayout_9.addWidget(self.treeWidget_explorer, 1, 0, 1, 1)
        self.tabWidget_tools.addTab(self.Files, "")
        self.Project = QtWidgets.QWidget()
        self.Project.setObjectName("Project")
        self.gridLayout_16 = QtWidgets.QGridLayout(self.Project)
        self.gridLayout_16.setObjectName("gridLayout_16")
        self.widget_library = QtWidgets.QWidget(self.Project)
        self.widget_library.setObjectName("widget_library")
        self.gridLayout_28 = QtWidgets.QGridLayout(self.widget_library)
        self.gridLayout_28.setContentsMargins(0, -1, 0, -1)
        self.gridLayout_28.setObjectName("gridLayout_28")
        self.pushButton_compilelibrary = QtWidgets.QPushButton(self.widget_library)
        self.pushButton_compilelibrary.setObjectName("pushButton_compilelibrary")
        self.gridLayout_28.addWidget(self.pushButton_compilelibrary, 0, 0, 1, 1)
        self.pushButton_packagelibrary = QtWidgets.QPushButton(self.widget_library)
        self.pushButton_packagelibrary.setObjectName("pushButton_packagelibrary")
        self.gridLayout_28.addWidget(self.pushButton_packagelibrary, 0, 1, 1, 1)
        self.gridLayout_16.addWidget(self.widget_library, 3, 0, 1, 2)
        self.widget_noproject = QtWidgets.QWidget(self.Project)
        self.widget_noproject.setObjectName("widget_noproject")
        self.gridLayout_20 = QtWidgets.QGridLayout(self.widget_noproject)
        self.gridLayout_20.setContentsMargins(0, -1, 0, -1)
        self.gridLayout_20.setObjectName("gridLayout_20")
        self.pushButton_openproject = QtWidgets.QPushButton(self.widget_noproject)
        self.pushButton_openproject.setObjectName("pushButton_openproject")
        self.gridLayout_20.addWidget(self.pushButton_openproject, 4, 0, 1, 4)
        spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_20.addItem(spacerItem2, 6, 0, 1, 4)
        spacerItem3 = QtWidgets.QSpacerItem(20, 60, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_20.addItem(spacerItem3, 0, 0, 1, 4)
        self.pushButton_newlibrary = QtWidgets.QPushButton(self.widget_noproject)
        self.pushButton_newlibrary.setObjectName("pushButton_newlibrary")
        self.gridLayout_20.addWidget(self.pushButton_newlibrary, 1, 2, 1, 2)
        self.pushButton_newproject = QtWidgets.QPushButton(self.widget_noproject)
        self.pushButton_newproject.setObjectName("pushButton_newproject")
        self.gridLayout_20.addWidget(self.pushButton_newproject, 1, 0, 1, 2)
        self.gridLayout_16.addWidget(self.widget_noproject, 1, 0, 1, 2)
        self.treeWidget_projects = QtWidgets.QTreeWidget(self.Project)
        self.treeWidget_projects.setMidLineWidth(1)
        self.treeWidget_projects.setRootIsDecorated(True)
        self.treeWidget_projects.setAnimated(True)
        self.treeWidget_projects.setColumnCount(1)
        self.treeWidget_projects.setObjectName("treeWidget_projects")
        self.treeWidget_projects.header().setDefaultSectionSize(100)
        self.treeWidget_projects.header().setSortIndicatorShown(False)
        self.treeWidget_projects.header().setStretchLastSection(True)
        self.gridLayout_16.addWidget(self.treeWidget_projects, 5, 0, 1, 2)
        self.tabWidget_tools.addTab(self.Project, "")
        self.SourceBrowser = QtWidgets.QWidget()
        self.SourceBrowser.setObjectName("SourceBrowser")
        self.gridLayout_25 = QtWidgets.QGridLayout(self.SourceBrowser)
        self.gridLayout_25.setObjectName("gridLayout_25")
        self.tabWidget_browser = QtWidgets.QTabWidget(self.SourceBrowser)
        self.tabWidget_browser.setTabPosition(QtWidgets.QTabWidget.South)
        self.tabWidget_browser.setObjectName("tabWidget_browser")
        self.Variables = QtWidgets.QWidget()
        self.Variables.setObjectName("Variables")
        self.gridLayout_6 = QtWidgets.QGridLayout(self.Variables)
        self.gridLayout_6.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_6.setSpacing(0)
        self.gridLayout_6.setObjectName("gridLayout_6")
        self.tableWidget_variables = QtWidgets.QTableWidget(self.Variables)
        self.tableWidget_variables.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.tableWidget_variables.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.tableWidget_variables.setAlternatingRowColors(True)
        self.tableWidget_variables.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
        self.tableWidget_variables.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
        self.tableWidget_variables.setGridStyle(QtCore.Qt.NoPen)
        self.tableWidget_variables.setObjectName("tableWidget_variables")
        self.tableWidget_variables.setColumnCount(2)
        self.tableWidget_variables.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_variables.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_variables.setHorizontalHeaderItem(1, item)
        self.tableWidget_variables.horizontalHeader().setStretchLastSection(True)
        self.gridLayout_6.addWidget(self.tableWidget_variables, 1, 0, 1, 1)
        self.tabWidget_browser.addTab(self.Variables, "")
        self.Functions = QtWidgets.QWidget()
        self.Functions.setObjectName("Functions")
        self.gridLayout_5 = QtWidgets.QGridLayout(self.Functions)
        self.gridLayout_5.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_5.setSpacing(0)
        self.gridLayout_5.setObjectName("gridLayout_5")
        self.tableWidget_functions = QtWidgets.QTableWidget(self.Functions)
        self.tableWidget_functions.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.tableWidget_functions.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.tableWidget_functions.setAlternatingRowColors(True)
        self.tableWidget_functions.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
        self.tableWidget_functions.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
        self.tableWidget_functions.setShowGrid(True)
        self.tableWidget_functions.setGridStyle(QtCore.Qt.NoPen)
        self.tableWidget_functions.setObjectName("tableWidget_functions")
        self.tableWidget_functions.setColumnCount(3)
        self.tableWidget_functions.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_functions.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_functions.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_functions.setHorizontalHeaderItem(2, item)
        self.tableWidget_functions.horizontalHeader().setStretchLastSection(True)
        self.gridLayout_5.addWidget(self.tableWidget_functions, 0, 0, 1, 1)
        self.tabWidget_browser.addTab(self.Functions, "")
        self.Directives = QtWidgets.QWidget()
        self.Directives.setObjectName("Directives")
        self.gridLayout_7 = QtWidgets.QGridLayout(self.Directives)
        self.gridLayout_7.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_7.setSpacing(0)
        self.gridLayout_7.setObjectName("gridLayout_7")
        self.tableWidget_directives = QtWidgets.QTableWidget(self.Directives)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(255, 85, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 85, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.AlternateBase, brush)
        brush = QtGui.QBrush(QtGui.QColor(255, 85, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.AlternateBase, brush)
        self.tableWidget_directives.setPalette(palette)
        self.tableWidget_directives.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.tableWidget_directives.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
        self.tableWidget_directives.setAlternatingRowColors(True)
        self.tableWidget_directives.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
        self.tableWidget_directives.setHorizontalScrollMode(QtWidgets.QAbstractItemView.ScrollPerPixel)
        self.tableWidget_directives.setGridStyle(QtCore.Qt.NoPen)
        self.tableWidget_directives.setObjectName("tableWidget_directives")
        self.tableWidget_directives.setColumnCount(3)
        self.tableWidget_directives.setRowCount(0)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_directives.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_directives.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_directives.setHorizontalHeaderItem(2, item)
        self.tableWidget_directives.horizontalHeader().setStretchLastSection(True)
        self.gridLayout_7.addWidget(self.tableWidget_directives, 0, 0, 1, 1)
        self.tabWidget_browser.addTab(self.Directives, "")
        self.gridLayout_25.addWidget(self.tabWidget_browser, 2, 0, 1, 1)
        self.frame_source_assistnant = QtWidgets.QFrame(self.SourceBrowser)
        self.frame_source_assistnant.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.frame_source_assistnant.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_source_assistnant.setObjectName("frame_source_assistnant")
        self.gridLayout_8 = QtWidgets.QGridLayout(self.frame_source_assistnant)
        self.gridLayout_8.setObjectName("gridLayout_8")
        self.formLayout_source_browser = QtWidgets.QFormLayout()
        self.formLayout_source_browser.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout_source_browser.setObjectName("formLayout_source_browser")
        self.label_name = QtWidgets.QLabel(self.frame_source_assistnant)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_name.setFont(font)
        self.label_name.setObjectName("label_name")
        self.formLayout_source_browser.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_name)
        self.label_name_edit = QtWidgets.QLabel(self.frame_source_assistnant)
        self.label_name_edit.setText("")
        self.label_name_edit.setObjectName("label_name_edit")
        self.formLayout_source_browser.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.label_name_edit)
        self.label_args = QtWidgets.QLabel(self.frame_source_assistnant)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_args.setFont(font)
        self.label_args.setObjectName("label_args")
        self.formLayout_source_browser.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_args)
        self.label_args_edit = QtWidgets.QLabel(self.frame_source_assistnant)
        self.label_args_edit.setText("")
        self.label_args_edit.setObjectName("label_args_edit")
        self.formLayout_source_browser.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.label_args_edit)
        self.label_library = QtWidgets.QLabel(self.frame_source_assistnant)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_library.setFont(font)
        self.label_library.setObjectName("label_library")
        self.formLayout_source_browser.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_library)
        self.label_library_edit = QtWidgets.QLabel(self.frame_source_assistnant)
        self.label_library_edit.setText("")
        self.label_library_edit.setObjectName("label_library_edit")
        self.formLayout_source_browser.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.label_library_edit)
        self.label_return = QtWidgets.QLabel(self.frame_source_assistnant)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.label_return.setFont(font)
        self.label_return.setObjectName("label_return")
        self.formLayout_source_browser.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_return)
        self.label_return_edit = QtWidgets.QLabel(self.frame_source_assistnant)
        self.label_return_edit.setText("")
        self.label_return_edit.setObjectName("label_return_edit")
        self.formLayout_source_browser.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.label_return_edit)
        self.gridLayout_8.addLayout(self.formLayout_source_browser, 0, 0, 1, 2)
        self.label_source_browser = QtWidgets.QLabel(self.frame_source_assistnant)
        self.label_source_browser.setStyleSheet("color: rgb(226, 0, 0);")
        self.label_source_browser.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_source_browser.setObjectName("label_source_browser")
        self.gridLayout_8.addWidget(self.label_source_browser, 1, 0, 1, 2)
        self.gridLayout_25.addWidget(self.frame_source_assistnant, 1, 0, 1, 1)
        self.tabWidget_tools.addTab(self.SourceBrowser, "")
        self.Boards = QtWidgets.QWidget()
        self.Boards.setObjectName("Boards")
        self.verticalLayout = QtWidgets.QVBoxLayout(self.Boards)
        self.verticalLayout.setObjectName("verticalLayout")
        self.frame_arch = QtWidgets.QFrame(self.Boards)
        self.frame_arch.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_arch.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_arch.setObjectName("frame_arch")
        self.gridLayout_22 = QtWidgets.QGridLayout(self.frame_arch)
        self.gridLayout_22.setObjectName("gridLayout_22")
        self.label_2 = QtWidgets.QLabel(self.frame_arch)
        self.label_2.setObjectName("label_2")
        self.gridLayout_22.addWidget(self.label_2, 0, 0, 1, 1)
        self.gridLayout_21 = QtWidgets.QGridLayout()
        self.gridLayout_21.setObjectName("gridLayout_21")
        self.radioButton_arch_8 = QtWidgets.QRadioButton(self.frame_arch)
        self.radioButton_arch_8.setChecked(True)
        self.radioButton_arch_8.setObjectName("radioButton_arch_8")
        self.gridLayout_21.addWidget(self.radioButton_arch_8, 0, 0, 1, 1)
        self.radioButton_arch_32 = QtWidgets.QRadioButton(self.frame_arch)
        self.radioButton_arch_32.setObjectName("radioButton_arch_32")
        self.gridLayout_21.addWidget(self.radioButton_arch_32, 0, 1, 1, 1)
        self.gridLayout_22.addLayout(self.gridLayout_21, 1, 0, 1, 1)
        self.line = QtWidgets.QFrame(self.frame_arch)
        self.line.setFrameShape(QtWidgets.QFrame.HLine)
        self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line.setObjectName("line")
        self.gridLayout_22.addWidget(self.line, 2, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_arch)
        self.frame_compiler = QtWidgets.QFrame(self.Boards)
        self.frame_compiler.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_compiler.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_compiler.setObjectName("frame_compiler")
        self.gridLayout_27 = QtWidgets.QGridLayout(self.frame_compiler)
        self.gridLayout_27.setObjectName("gridLayout_27")
        self.label_7 = QtWidgets.QLabel(self.frame_compiler)
        self.label_7.setObjectName("label_7")
        self.gridLayout_27.addWidget(self.label_7, 0, 0, 1, 1)
        self.gridLayout_26 = QtWidgets.QGridLayout()
        self.gridLayout_26.setObjectName("gridLayout_26")
        self.radioButton_compiler_xc8 = QtWidgets.QRadioButton(self.frame_compiler)
        self.radioButton_compiler_xc8.setEnabled(True)
        self.radioButton_compiler_xc8.setChecked(False)
        self.radioButton_compiler_xc8.setObjectName("radioButton_compiler_xc8")
        self.gridLayout_26.addWidget(self.radioButton_compiler_xc8, 0, 1, 1, 1)
        self.radioButton_compiler_sdcc = QtWidgets.QRadioButton(self.frame_compiler)
        self.radioButton_compiler_sdcc.setChecked(True)
        self.radioButton_compiler_sdcc.setObjectName("radioButton_compiler_sdcc")
        self.gridLayout_26.addWidget(self.radioButton_compiler_sdcc, 0, 0, 1, 1)
        self.gridLayout_27.addLayout(self.gridLayout_26, 1, 0, 1, 1)
        self.line_4 = QtWidgets.QFrame(self.frame_compiler)
        self.line_4.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_4.setObjectName("line_4")
        self.gridLayout_27.addWidget(self.line_4, 2, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_compiler)
        self.frame_prgmode = QtWidgets.QFrame(self.Boards)
        self.frame_prgmode.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_prgmode.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_prgmode.setObjectName("frame_prgmode")
        self.gridLayout_23 = QtWidgets.QGridLayout(self.frame_prgmode)
        self.gridLayout_23.setObjectName("gridLayout_23")
        self.line_2 = QtWidgets.QFrame(self.frame_prgmode)
        self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_2.setObjectName("line_2")
        self.gridLayout_23.addWidget(self.line_2, 4, 0, 1, 1)
        self.gridLayout_18 = QtWidgets.QGridLayout()
        self.gridLayout_18.setObjectName("gridLayout_18")
        self.radioButton_mode_usb = QtWidgets.QRadioButton(self.frame_prgmode)
        self.radioButton_mode_usb.setChecked(True)
        self.radioButton_mode_usb.setObjectName("radioButton_mode_usb")
        self.gridLayout_18.addWidget(self.radioButton_mode_usb, 1, 0, 1, 1)
        self.radioButton_mode_icsp = QtWidgets.QRadioButton(self.frame_prgmode)
        self.radioButton_mode_icsp.setText("ICSP")
        self.radioButton_mode_icsp.setObjectName("radioButton_mode_icsp")
        self.gridLayout_18.addWidget(self.radioButton_mode_icsp, 0, 0, 1, 1)
        self.radioButton_mode_bt = QtWidgets.QRadioButton(self.frame_prgmode)
        self.radioButton_mode_bt.setObjectName("radioButton_mode_bt")
        self.gridLayout_18.addWidget(self.radioButton_mode_bt, 2, 0, 1, 1)
        self.gridLayout_23.addLayout(self.gridLayout_18, 3, 0, 1, 1)
        self.label = QtWidgets.QLabel(self.frame_prgmode)
        self.label.setObjectName("label")
        self.gridLayout_23.addWidget(self.label, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_prgmode)
        self.frame_devices_8 = QtWidgets.QFrame(self.Boards)
        self.frame_devices_8.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_devices_8.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_devices_8.setObjectName("frame_devices_8")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.frame_devices_8)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout_device_8 = QtWidgets.QGridLayout()
        self.gridLayout_device_8.setObjectName("gridLayout_device_8")
        self.gridLayout_3.addLayout(self.gridLayout_device_8, 1, 0, 1, 1)
        self.label_4 = QtWidgets.QLabel(self.frame_devices_8)
        self.label_4.setObjectName("label_4")
        self.gridLayout_3.addWidget(self.label_4, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_devices_8)
        self.frame_devices_32 = QtWidgets.QFrame(self.Boards)
        self.frame_devices_32.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_devices_32.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_devices_32.setObjectName("frame_devices_32")
        self.gridLayout_14 = QtWidgets.QGridLayout(self.frame_devices_32)
        self.gridLayout_14.setObjectName("gridLayout_14")
        self.label_5 = QtWidgets.QLabel(self.frame_devices_32)
        self.label_5.setObjectName("label_5")
        self.gridLayout_14.addWidget(self.label_5, 0, 0, 1, 1)
        self.gridLayout_device_32 = QtWidgets.QGridLayout()
        self.gridLayout_device_32.setObjectName("gridLayout_device_32")
        self.gridLayout_14.addLayout(self.gridLayout_device_32, 1, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_devices_32)
        self.frame_advance = QtWidgets.QFrame(self.Boards)
        self.frame_advance.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame_advance.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame_advance.setObjectName("frame_advance")
        self.gridLayout_17 = QtWidgets.QGridLayout(self.frame_advance)
        self.gridLayout_17.setObjectName("gridLayout_17")
        self.checkBox_mips16 = QtWidgets.QCheckBox(self.frame_advance)
        self.checkBox_mips16.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.checkBox_mips16.setObjectName("checkBox_mips16")
        self.gridLayout_17.addWidget(self.checkBox_mips16, 2, 0, 1, 1)
        self.label_6 = QtWidgets.QLabel(self.frame_advance)
        self.label_6.setObjectName("label_6")
        self.gridLayout_17.addWidget(self.label_6, 1, 0, 1, 1)
        self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.label_9 = QtWidgets.QLabel(self.frame_advance)
        self.label_9.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.label_9.setObjectName("label_9")
        self.horizontalLayout_7.addWidget(self.label_9)
        self.comboBox_optimization = QtWidgets.QComboBox(self.frame_advance)
        self.comboBox_optimization.setObjectName("comboBox_optimization")
        self.comboBox_optimization.addItem("")
        self.comboBox_optimization.addItem("")
        self.comboBox_optimization.addItem("")
        self.horizontalLayout_7.addWidget(self.comboBox_optimization)
        self.gridLayout_17.addLayout(self.horizontalLayout_7, 4, 0, 1, 1)
        self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.label_8 = QtWidgets.QLabel(self.frame_advance)
        self.label_8.setCursor(QtGui.QCursor(QtCore.Qt.WhatsThisCursor))
        self.label_8.setObjectName("label_8")
        self.horizontalLayout_6.addWidget(self.label_8)
        self.spinBox_heapsize = QtWidgets.QSpinBox(self.frame_advance)
        self.spinBox_heapsize.setMaximum(8192)
        self.spinBox_heapsize.setSingleStep(512)
        self.spinBox_heapsize.setObjectName("spinBox_heapsize")
        self.horizontalLayout_6.addWidget(self.spinBox_heapsize)
        self.gridLayout_17.addLayout(self.horizontalLayout_6, 3, 0, 1, 1)
        self.line_5 = QtWidgets.QFrame(self.frame_advance)
        self.line_5.setFrameShape(QtWidgets.QFrame.HLine)
        self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.line_5.setObjectName("line_5")
        self.gridLayout_17.addWidget(self.line_5, 0, 0, 1, 1)
        self.verticalLayout.addWidget(self.frame_advance)
        spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem4)
        self.tabWidget_tools.addTab(self.Boards, "")
        self.Search = QtWidgets.QWidget()
        self.Search.setObjectName("Search")
        self.gridLayout_10 = QtWidgets.QGridLayout(self.Search)
        self.gridLayout_10.setContentsMargins(-1, -1, -1, 0)
        self.gridLayout_10.setHorizontalSpacing(0)
        self.gridLayout_10.setObjectName("gridLayout_10")
        self.checkBox_case_sensitive = QtWidgets.QCheckBox(self.Search)
        self.checkBox_case_sensitive.setObjectName("checkBox_case_sensitive")
        self.gridLayout_10.addWidget(self.checkBox_case_sensitive, 2, 0, 1, 1)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.label_search = QtWidgets.QLabel(self.Search)
        self.label_search.setObjectName("label_search")
        self.horizontalLayout_2.addWidget(self.label_search)
        self.lineEdit_search = QtWidgets.QLineEdit(self.Search)
        self.lineEdit_search.setText("")
        self.lineEdit_search.setObjectName("lineEdit_search")
        self.horizontalLayout_2.addWidget(self.lineEdit_search)
        self.gridLayout_10.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
        self.horizontalLayout_replace = QtWidgets.QHBoxLayout()
        self.horizontalLayout_replace.setObjectName("horizontalLayout_replace")
        self.label_replace = QtWidgets.QLabel(self.Search)
        self.label_replace.setObjectName("label_replace")
        self.horizontalLayout_replace.addWidget(self.label_replace)
        self.lineEdit_replace = QtWidgets.QLineEdit(self.Search)
        self.lineEdit_replace.setObjectName("lineEdit_replace")
        self.horizontalLayout_replace.addWidget(self.lineEdit_replace)
        self.gridLayout_10.addLayout(self.horizontalLayout_replace, 1, 0, 1, 1)
        self.label_replace_info = QtWidgets.QLabel(self.Search)
        self.label_replace_info.setText("")
        self.label_replace_info.setObjectName("label_replace_info")
        self.gridLayout_10.addWidget(self.label_replace_info, 5, 0, 1, 1)
        spacerItem5 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_10.addItem(spacerItem5, 6, 0, 1, 1)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.pushButton_search_previous = QtWidgets.QPushButton(self.Search)
        self.pushButton_search_previous.setEnabled(False)
        icon = QtGui.QIcon.fromTheme("go-top")
        self.pushButton_search_previous.setIcon(icon)
        self.pushButton_search_previous.setObjectName("pushButton_search_previous")
        self.horizontalLayout_4.addWidget(self.pushButton_search_previous)
        self.pushButton_search_next = QtWidgets.QPushButton(self.Search)
        self.pushButton_search_next.setEnabled(False)
        icon = QtGui.QIcon.fromTheme("go-down")
        self.pushButton_search_next.setIcon(icon)
        self.pushButton_search_next.setObjectName("pushButton_search_next")
        self.horizontalLayout_4.addWidget(self.pushButton_search_next)
        self.pushButton_replace = QtWidgets.QPushButton(self.Search)
        self.pushButton_replace.setEnabled(False)
        self.pushButton_replace.setObjectName("pushButton_replace")
        self.horizontalLayout_4.addWidget(self.pushButton_replace)
        self.pushButton_replace_all = QtWidgets.QPushButton(self.Search)
        self.pushButton_replace_all.setEnabled(False)
        self.pushButton_replace_all.setObjectName("pushButton_replace_all")
        self.horizontalLayout_4.addWidget(self.pushButton_replace_all)
        self.gridLayout_10.addLayout(self.horizontalLayout_4, 3, 0, 1, 1)
        spacerItem6 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
        self.gridLayout_10.addItem(spacerItem6, 4, 0, 1, 1)
        self.tabWidget_tools.addTab(self.Search, "")
        self.Blocks = QtWidgets.QWidget()
        self.Blocks.setObjectName("Blocks")
        self.gridLayout_4 = QtWidgets.QGridLayout(self.Blocks)
        self.gridLayout_4.setObjectName("gridLayout_4")
        self.comboBox_blocks = QtWidgets.QComboBox(self.Blocks)
        self.comboBox_blocks.setObjectName("comboBox_blocks")
        self.gridLayout_4.addWidget(self.comboBox_blocks, 0, 0, 1, 1)
        self.stackedWidget_blocks = QtWidgets.QStackedWidget(self.Blocks)
        self.stackedWidget_blocks.setObjectName("stackedWidget_blocks")
        self.gridLayout_4.addWidget(self.stackedWidget_blocks, 1, 0, 1, 1)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label_search_block = QtWidgets.QLabel(self.Blocks)
        self.label_search_block.setObjectName("label_search_block")
        self.horizontalLayout_3.addWidget(self.label_search_block)
        self.lineEdit_blocks_search = QtWidgets.QLineEdit(self.Blocks)
        self.lineEdit_blocks_search.setObjectName("lineEdit_blocks_search")
        self.horizontalLayout_3.addWidget(self.lineEdit_blocks_search)
        self.gridLayout_4.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)
        self.tabWidget_tools.addTab(self.Blocks, "")
        self.Paths = QtWidgets.QWidget()
        self.Paths.setObjectName("Paths")
        self.gridLayout_31 = QtWidgets.QGridLayout(self.Paths)
        self.gridLayout_31.setObjectName("gridLayout_31")
        self.checkBox_paths_default = QtWidgets.QCheckBox(self.Paths)
        self.checkBox_paths_default.setChecked(True)
        self.checkBox_paths_default.setObjectName("checkBox_paths_default")
        self.gridLayout_31.addWidget(self.checkBox_paths_default, 4, 1, 1, 1)
        self.groupBox_compilers = QtWidgets.QGroupBox(self.Paths)
        self.groupBox_compilers.setObjectName("groupBox_compilers")
        self.gridLayout_33 = QtWidgets.QGridLayout(self.groupBox_compilers)
        self.gridLayout_33.setObjectName("gridLayout_33")
        self.gridLayout_24 = QtWidgets.QGridLayout()
        self.gridLayout_24.setObjectName("gridLayout_24")
        self.label_10 = QtWidgets.QLabel(self.groupBox_compilers)
        self.label_10.setObjectName("label_10")
        self.gridLayout_24.addWidget(self.label_10, 0, 0, 1, 1)
        self.lineEdit_path_gcc_bin = QtWidgets.QLineEdit(self.groupBox_compilers)
        self.lineEdit_path_gcc_bin.setObjectName("lineEdit_path_gcc_bin")
        self.gridLayout_24.addWidget(self.lineEdit_path_gcc_bin, 1, 0, 1, 1)
        self.pushButton_dir_gcc = QtWidgets.QPushButton(self.groupBox_compilers)
        self.pushButton_dir_gcc.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_gcc.setFlat(True)
        self.pushButton_dir_gcc.setObjectName("pushButton_dir_gcc")
        self.gridLayout_24.addWidget(self.pushButton_dir_gcc, 1, 1, 1, 1)
        self.gridLayout_33.addLayout(self.gridLayout_24, 0, 0, 1, 1)
        self.gridLayout_30 = QtWidgets.QGridLayout()
        self.gridLayout_30.setObjectName("gridLayout_30")
        self.label_3 = QtWidgets.QLabel(self.groupBox_compilers)
        self.label_3.setObjectName("label_3")
        self.gridLayout_30.addWidget(self.label_3, 0, 0, 1, 1)
        self.lineEdit_path_sdcc_bin = QtWidgets.QLineEdit(self.groupBox_compilers)
        self.lineEdit_path_sdcc_bin.setObjectName("lineEdit_path_sdcc_bin")
        self.gridLayout_30.addWidget(self.lineEdit_path_sdcc_bin, 1, 0, 1, 1)
        self.pushButton_dir_sdcc = QtWidgets.QPushButton(self.groupBox_compilers)
        self.pushButton_dir_sdcc.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_sdcc.setFlat(True)
        self.pushButton_dir_sdcc.setObjectName("pushButton_dir_sdcc")
        self.gridLayout_30.addWidget(self.pushButton_dir_sdcc, 1, 1, 1, 1)
        self.gridLayout_33.addLayout(self.gridLayout_30, 1, 0, 1, 1)
        self.gridLayout_32 = QtWidgets.QGridLayout()
        self.gridLayout_32.setObjectName("gridLayout_32")
        self.label_11 = QtWidgets.QLabel(self.groupBox_compilers)
        self.label_11.setObjectName("label_11")
        self.gridLayout_32.addWidget(self.label_11, 0, 0, 1, 1)
        self.lineEdit_path_xc8_bin = QtWidgets.QLineEdit(self.groupBox_compilers)
        self.lineEdit_path_xc8_bin.setObjectName("lineEdit_path_xc8_bin")
        self.gridLayout_32.addWidget(self.lineEdit_path_xc8_bin, 1, 0, 1, 1)
        self.pushButton_dir_xc8 = QtWidgets.QPushButton(self.groupBox_compilers)
        self.pushButton_dir_xc8.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_xc8.setFlat(True)
        self.pushButton_dir_xc8.setObjectName("pushButton_dir_xc8")
        self.gridLayout_32.addWidget(self.pushButton_dir_xc8, 1, 1, 1, 1)
        self.gridLayout_33.addLayout(self.gridLayout_32, 2, 0, 1, 1)
        self.gridLayout_31.addWidget(self.groupBox_compilers, 0, 0, 1, 2)
        self.groupBox_libraries = QtWidgets.QGroupBox(self.Paths)
        self.groupBox_libraries.setObjectName("groupBox_libraries")
        self.gridLayout_34 = QtWidgets.QGridLayout(self.groupBox_libraries)
        self.gridLayout_34.setObjectName("gridLayout_34")
        self.gridLayout_36 = QtWidgets.QGridLayout()
        self.gridLayout_36.setObjectName("gridLayout_36")
        self.lineEdit_path_32_libs = QtWidgets.QLineEdit(self.groupBox_libraries)
        self.lineEdit_path_32_libs.setObjectName("lineEdit_path_32_libs")
        self.gridLayout_36.addWidget(self.lineEdit_path_32_libs, 1, 0, 1, 1)
        self.label_13 = QtWidgets.QLabel(self.groupBox_libraries)
        self.label_13.setObjectName("label_13")
        self.gridLayout_36.addWidget(self.label_13, 0, 0, 1, 1)
        self.pushButton_dir_32bit = QtWidgets.QPushButton(self.groupBox_libraries)
        self.pushButton_dir_32bit.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_32bit.setFlat(True)
        self.pushButton_dir_32bit.setObjectName("pushButton_dir_32bit")
        self.gridLayout_36.addWidget(self.pushButton_dir_32bit, 1, 1, 1, 1)
        self.gridLayout_34.addLayout(self.gridLayout_36, 1, 0, 1, 1)
        self.gridLayout_35 = QtWidgets.QGridLayout()
        self.gridLayout_35.setObjectName("gridLayout_35")
        self.label_12 = QtWidgets.QLabel(self.groupBox_libraries)
        self.label_12.setObjectName("label_12")
        self.gridLayout_35.addWidget(self.label_12, 0, 0, 1, 1)
        self.lineEdit_path_8_libs = QtWidgets.QLineEdit(self.groupBox_libraries)
        self.lineEdit_path_8_libs.setObjectName("lineEdit_path_8_libs")
        self.gridLayout_35.addWidget(self.lineEdit_path_8_libs, 1, 0, 1, 1)
        self.pushButton_dir_8bit = QtWidgets.QPushButton(self.groupBox_libraries)
        self.pushButton_dir_8bit.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_8bit.setFlat(True)
        self.pushButton_dir_8bit.setObjectName("pushButton_dir_8bit")
        self.gridLayout_35.addWidget(self.pushButton_dir_8bit, 1, 1, 1, 1)
        self.gridLayout_34.addLayout(self.gridLayout_35, 0, 0, 1, 1)
        self.gridLayout_37 = QtWidgets.QGridLayout()
        self.gridLayout_37.setObjectName("gridLayout_37")
        self.lineEdit_path_custom_libs = QtWidgets.QLineEdit(self.groupBox_libraries)
        self.lineEdit_path_custom_libs.setObjectName("lineEdit_path_custom_libs")
        self.gridLayout_37.addWidget(self.lineEdit_path_custom_libs, 1, 0, 1, 1)
        self.label_14 = QtWidgets.QLabel(self.groupBox_libraries)
        self.label_14.setObjectName("label_14")
        self.gridLayout_37.addWidget(self.label_14, 0, 0, 1, 1)
        self.pushButton_dir_libs = QtWidgets.QPushButton(self.groupBox_libraries)
        self.pushButton_dir_libs.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_libs.setFlat(True)
        self.pushButton_dir_libs.setObjectName("pushButton_dir_libs")
        self.gridLayout_37.addWidget(self.pushButton_dir_libs, 1, 1, 1, 1)
        self.gridLayout_34.addLayout(self.gridLayout_37, 2, 0, 1, 1)
        self.gridLayout_31.addWidget(self.groupBox_libraries, 1, 0, 1, 2)
        spacerItem7 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        self.gridLayout_31.addItem(spacerItem7, 4, 0, 1, 1)
        self.groupBox_icsp = QtWidgets.QGroupBox(self.Paths)
        self.groupBox_icsp.setObjectName("groupBox_icsp")
        self.gridLayout_19 = QtWidgets.QGridLayout(self.groupBox_icsp)
        self.gridLayout_19.setObjectName("gridLayout_19")
        self.gridLayout_38 = QtWidgets.QGridLayout()
        self.gridLayout_38.setObjectName("gridLayout_38")
        self.label_15 = QtWidgets.QLabel(self.groupBox_icsp)
        self.label_15.setObjectName("label_15")
        self.gridLayout_38.addWidget(self.label_15, 0, 0, 1, 1)
        self.lineEdit_path_mplab = QtWidgets.QLineEdit(self.groupBox_icsp)
        self.lineEdit_path_mplab.setObjectName("lineEdit_path_mplab")
        self.gridLayout_38.addWidget(self.lineEdit_path_mplab, 1, 0, 1, 1)
        self.pushButton_dir_mplab = QtWidgets.QPushButton(self.groupBox_icsp)
        self.pushButton_dir_mplab.setMaximumSize(QtCore.QSize(34, 16777215))
        self.pushButton_dir_mplab.setFlat(True)
        self.pushButton_dir_mplab.setObjectName("pushButton_dir_mplab")
        self.gridLayout_38.addWidget(self.pushButton_dir_mplab, 1, 1, 1, 1)
        self.gridLayout_19.addLayout(self.gridLayout_38, 0, 0, 1, 1)
        self.gridLayout_31.addWidget(self.groupBox_icsp, 2, 0, 1, 2)
        spacerItem8 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout_31.addItem(spacerItem8, 3, 0, 1, 2)
        self.tabWidget_tools.addTab(self.Paths, "")
        self.gridLayout_15.addWidget(self.tabWidget_tools, 0, 0, 1, 1)
        self.dockWidget_right.setWidget(self.dockWidgetContents_rigth)
        PinguinoIDE.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget_right)
        self.toolBar = QtWidgets.QToolBar(PinguinoIDE)
        self.toolBar.setMovable(False)
        self.toolBar.setIconSize(QtCore.QSize(32, 32))
        self.toolBar.setObjectName("toolBar")
        PinguinoIDE.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
        self.statusBar = QtWidgets.QStatusBar(PinguinoIDE)
        self.statusBar.setObjectName("statusBar")
        PinguinoIDE.setStatusBar(self.statusBar)
        self.dockWidget_bottom = QtWidgets.QDockWidget(PinguinoIDE)
        self.dockWidget_bottom.setFeatures(QtWidgets.QDockWidget.NoDockWidgetFeatures)
        self.dockWidget_bottom.setObjectName("dockWidget_bottom")
        self.dockWidgetContents_bottom = QtWidgets.QWidget()
        self.dockWidgetContents_bottom.setObjectName("dockWidgetContents_bottom")
        self.gridLayout_2 = QtWidgets.QGridLayout(self.dockWidgetContents_bottom)
        self.gridLayout_2.setContentsMargins(0, 3, 0, 0)
        self.gridLayout_2.setSpacing(0)
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.tabWidget_bottom = QtWidgets.QTabWidget(self.dockWidgetContents_bottom)
        self.tabWidget_bottom.setAcceptDrops(True)
        self.tabWidget_bottom.setMovable(True)
        self.tabWidget_bottom.setObjectName("tabWidget_bottom")
        self.Shell = QtWidgets.QWidget()
        self.Shell.setObjectName("Shell")
        self.gridLayout_11 = QtWidgets.QGridLayout(self.Shell)
        self.gridLayout_11.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_11.setSpacing(0)
        self.gridLayout_11.setObjectName("gridLayout_11")
        self.gridLayout_shell = QtWidgets.QGridLayout()
        self.gridLayout_shell.setObjectName("gridLayout_shell")
        self.gridLayout_11.addLayout(self.gridLayout_shell, 0, 0, 1, 1)
        self.tabWidget_bottom.addTab(self.Shell, "")
        self.Log = QtWidgets.QWidget()
        self.Log.setObjectName("Log")
        self.gridLayout_12 = QtWidgets.QGridLayout(self.Log)
        self.gridLayout_12.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_12.setSpacing(0)
        self.gridLayout_12.setObjectName("gridLayout_12")
        self.gridLayout_log = QtWidgets.QGridLayout()
        self.gridLayout_log.setObjectName("gridLayout_log")
        self.gridLayout_12.addLayout(self.gridLayout_log, 0, 0, 1, 1)
        self.tabWidget_bottom.addTab(self.Log, "")
        self.Stdout = QtWidgets.QWidget()
        self.Stdout.setObjectName("Stdout")
        self.gridLayout_13 = QtWidgets.QGridLayout(self.Stdout)
        self.gridLayout_13.setContentsMargins(0, 0, 0, 0)
        self.gridLayout_13.setSpacing(0)
        self.gridLayout_13.setObjectName("gridLayout_13")
        self.gridLayout_stdout = QtWidgets.QGridLayout()
        self.gridLayout_stdout.setObjectName("gridLayout_stdout")
        self.plainTextEdit_stdout = QtWidgets.QPlainTextEdit(self.Stdout)
        self.plainTextEdit_stdout.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.plainTextEdit_stdout.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap)
        self.plainTextEdit_stdout.setReadOnly(True)
        self.plainTextEdit_stdout.setObjectName("plainTextEdit_stdout")
        self.gridLayout_stdout.addWidget(self.plainTextEdit_stdout, 0, 0, 1, 1)
        self.gridLayout_13.addLayout(self.gridLayout_stdout, 0, 0, 1, 1)
        self.tabWidget_bottom.addTab(self.Stdout, "")
        self.gridLayout_2.addWidget(self.tabWidget_bottom, 0, 0, 1, 1)
        self.dockWidget_bottom.setWidget(self.dockWidgetContents_bottom)
        PinguinoIDE.addDockWidget(QtCore.Qt.DockWidgetArea(8), self.dockWidget_bottom)
        self.toolBar_menu = QtWidgets.QToolBar(PinguinoIDE)
        self.toolBar_menu.setMovable(False)
        self.toolBar_menu.setIconSize(QtCore.QSize(32, 32))
        self.toolBar_menu.setObjectName("toolBar_menu")
        PinguinoIDE.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar_menu)
        self.actionNew_file = QtWidgets.QAction(PinguinoIDE)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/document-new.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionNew_file.setIcon(icon1)
        self.actionNew_file.setObjectName("actionNew_file")
        self.actionOpen_file = QtWidgets.QAction(PinguinoIDE)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/document-open.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionOpen_file.setIcon(icon2)
        self.actionOpen_file.setObjectName("actionOpen_file")
        self.actionSave_file = QtWidgets.QAction(PinguinoIDE)
        self.actionSave_file.setEnabled(False)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/document-save.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave_file.setIcon(icon3)
        self.actionSave_file.setObjectName("actionSave_file")
        self.actionClose_file = QtWidgets.QAction(PinguinoIDE)
        self.actionClose_file.setEnabled(False)
        self.actionClose_file.setObjectName("actionClose_file")
        self.actionUndo = QtWidgets.QAction(PinguinoIDE)
        self.actionUndo.setEnabled(False)
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-undo.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionUndo.setIcon(icon4)
        self.actionUndo.setObjectName("actionUndo")
        self.actionRedo = QtWidgets.QAction(PinguinoIDE)
        self.actionRedo.setEnabled(False)
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-redo.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRedo.setIcon(icon5)
        self.actionRedo.setObjectName("actionRedo")
        self.actionCut = QtWidgets.QAction(PinguinoIDE)
        self.actionCut.setEnabled(False)
        icon6 = QtGui.QIcon()
        icon6.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-cut.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCut.setIcon(icon6)
        self.actionCut.setObjectName("actionCut")
        self.actionCopy = QtWidgets.QAction(PinguinoIDE)
        self.actionCopy.setEnabled(False)
        icon7 = QtGui.QIcon()
        icon7.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-copy.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCopy.setIcon(icon7)
        self.actionCopy.setObjectName("actionCopy")
        self.actionPaste = QtWidgets.QAction(PinguinoIDE)
        self.actionPaste.setEnabled(False)
        icon8 = QtGui.QIcon()
        icon8.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-paste.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionPaste.setIcon(icon8)
        self.actionPaste.setObjectName("actionPaste")
        self.actionSearch = QtWidgets.QAction(PinguinoIDE)
        self.actionSearch.setEnabled(False)
        icon9 = QtGui.QIcon()
        icon9.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/edit-find.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSearch.setIcon(icon9)
        self.actionSearch.setObjectName("actionSearch")
        self.actionSearch_and_replace = QtWidgets.QAction(PinguinoIDE)
        self.actionSearch_and_replace.setEnabled(False)
        self.actionSearch_and_replace.setIcon(icon9)
        self.actionSearch_and_replace.setObjectName("actionSearch_and_replace")
        self.actionSelect_board = QtWidgets.QAction(PinguinoIDE)
        icon10 = QtGui.QIcon()
        icon10.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/applications-electronics.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSelect_board.setIcon(icon10)
        self.actionSelect_board.setObjectName("actionSelect_board")
        self.actionCompile = QtWidgets.QAction(PinguinoIDE)
        self.actionCompile.setEnabled(False)
        icon11 = QtGui.QIcon()
        icon11.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/system-run.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionCompile.setIcon(icon11)
        self.actionCompile.setObjectName("actionCompile")
        self.actionUpload = QtWidgets.QAction(PinguinoIDE)
        self.actionUpload.setEnabled(False)
        icon12 = QtGui.QIcon()
        icon12.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/emblem-downloads.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionUpload.setIcon(icon12)
        self.actionUpload.setObjectName("actionUpload")
        self.actionQuit = QtWidgets.QAction(PinguinoIDE)
        self.actionQuit.setObjectName("actionQuit")
        self.actionAbout = QtWidgets.QAction(PinguinoIDE)
        self.actionAbout.setObjectName("actionAbout")
        self.actionComment_Uncomment_region = QtWidgets.QAction(PinguinoIDE)
        self.actionComment_Uncomment_region.setObjectName("actionComment_Uncomment_region")
        self.actionComment_out_region = QtWidgets.QAction(PinguinoIDE)
        self.actionComment_out_region.setObjectName("actionComment_out_region")
        self.actionSave_image = QtWidgets.QAction(PinguinoIDE)
        icon13 = QtGui.QIcon()
        icon13.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/applets-screenshooter.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionSave_image.setIcon(icon13)
        self.actionSave_image.setObjectName("actionSave_image")
        self.actionSave_all = QtWidgets.QAction(PinguinoIDE)
        self.actionSave_all.setObjectName("actionSave_all")
        self.actionClose_all = QtWidgets.QAction(PinguinoIDE)
        self.actionClose_all.setObjectName("actionClose_all")
        self.actionWebsite = QtWidgets.QAction(PinguinoIDE)
        self.actionWebsite.setObjectName("actionWebsite")
        self.actionWiki = QtWidgets.QAction(PinguinoIDE)
        self.actionWiki.setObjectName("actionWiki")
        self.actionForum = QtWidgets.QAction(PinguinoIDE)
        self.actionForum.setObjectName("actionForum")
        self.actionBlog = QtWidgets.QAction(PinguinoIDE)
        self.actionBlog.setObjectName("actionBlog")
        self.actionGroup = QtWidgets.QAction(PinguinoIDE)
        self.actionGroup.setObjectName("actionGroup")
        self.actionShop = QtWidgets.QAction(PinguinoIDE)
        self.actionShop.setObjectName("actionShop")
        self.actionSave_as = QtWidgets.QAction(PinguinoIDE)
        self.actionSave_as.setObjectName("actionSave_as")
        self.actionAutocomplete = QtWidgets.QAction(PinguinoIDE)
        self.actionAutocomplete.setCheckable(True)
        self.actionAutocomplete.setChecked(True)
        self.actionAutocomplete.setObjectName("actionAutocomplete")
        self.actionColor_theme = QtWidgets.QAction(PinguinoIDE)
        self.actionColor_theme.setCheckable(True)
        self.actionColor_theme.setChecked(False)
        self.actionColor_theme.setObjectName("actionColor_theme")
        self.actionLibraryManager = QtWidgets.QAction(PinguinoIDE)
        self.actionLibraryManager.setCheckable(True)
        self.actionLibraryManager.setChecked(True)
        self.actionLibraryManager.setObjectName("actionLibraryManager")
        self.actionIndent = QtWidgets.QAction(PinguinoIDE)
        self.actionIndent.setObjectName("actionIndent")
        self.actionDedent = QtWidgets.QAction(PinguinoIDE)
        self.actionDedent.setObjectName("actionDedent")
        self.actionClose_others = QtWidgets.QAction(PinguinoIDE)
        self.actionClose_others.setObjectName("actionClose_others")
        self.actionDelete = QtWidgets.QAction(PinguinoIDE)
        self.actionDelete.setObjectName("actionDelete")
        self.actionSelect_all = QtWidgets.QAction(PinguinoIDE)
        self.actionSelect_all.setObjectName("actionSelect_all")
        self.actionPrint = QtWidgets.QAction(PinguinoIDE)
        self.actionPrint.setObjectName("actionPrint")
        self.actionToolbars = QtWidgets.QAction(PinguinoIDE)
        self.actionToolbars.setCheckable(True)
        self.actionToolbars.setChecked(True)
        self.actionToolbars.setObjectName("actionToolbars")
        self.actionIf_Compile_then_Upload = QtWidgets.QAction(PinguinoIDE)
        self.actionIf_Compile_then_Upload.setObjectName("actionIf_Compile_then_Upload")
        self.actionGitPinguinoIde = QtWidgets.QAction(PinguinoIDE)
        self.actionGitPinguinoIde.setObjectName("actionGitPinguinoIde")
        self.actionGitPinguinoLibraries = QtWidgets.QAction(PinguinoIDE)
        self.actionGitPinguinoLibraries.setObjectName("actionGitPinguinoLibraries")
        self.actionPinguino11 = QtWidgets.QAction(PinguinoIDE)
        self.actionPinguino11.setObjectName("actionPinguino11")
        self.action16x16 = QtWidgets.QAction(PinguinoIDE)
        self.action16x16.setCheckable(True)
        self.action16x16.setObjectName("action16x16")
        self.action24x24 = QtWidgets.QAction(PinguinoIDE)
        self.action24x24.setCheckable(True)
        self.action24x24.setObjectName("action24x24")
        self.action32x32 = QtWidgets.QAction(PinguinoIDE)
        self.action32x32.setCheckable(True)
        self.action32x32.setObjectName("action32x32")
        self.action48x48 = QtWidgets.QAction(PinguinoIDE)
        self.action48x48.setCheckable(True)
        self.action48x48.setObjectName("action48x48")
        self.actionMain_c = QtWidgets.QAction(PinguinoIDE)
        self.actionMain_c.setObjectName("actionMain_c")
        self.actionDefine_h = QtWidgets.QAction(PinguinoIDE)
        self.actionDefine_h.setObjectName("actionDefine_h")
        self.actionUser_c = QtWidgets.QAction(PinguinoIDE)
        self.actionUser_c.setObjectName("actionUser_c")
        self.actionUpload_hex_directly = QtWidgets.QAction(PinguinoIDE)
        self.actionUpload_hex_directly.setObjectName("actionUpload_hex_directly")
        self.actionMenubar = QtWidgets.QAction(PinguinoIDE)
        self.actionMenubar.setCheckable(True)
        self.actionMenubar.setChecked(True)
        self.actionMenubar.setObjectName("actionMenubar")
        self.actionNew_project = QtWidgets.QAction(PinguinoIDE)
        self.actionNew_project.setObjectName("actionNew_project")
        self.actionOpen_project = QtWidgets.QAction(PinguinoIDE)
        self.actionOpen_project.setObjectName("actionOpen_project")
        self.action_list_recent = QtWidgets.QAction(PinguinoIDE)
        self.action_list_recent.setObjectName("action_list_recent")
        self.actionSave_project = QtWidgets.QAction(PinguinoIDE)
        self.actionSave_project.setObjectName("actionSave_project")
        self.actionSave_project_as = QtWidgets.QAction(PinguinoIDE)
        self.actionSave_project_as.setObjectName("actionSave_project_as")
        self.actionClose_project = QtWidgets.QAction(PinguinoIDE)
        self.actionClose_project.setObjectName("actionClose_project")
        self.actionAdd_existing_directory = QtWidgets.QAction(PinguinoIDE)
        self.actionAdd_existing_directory.setObjectName("actionAdd_existing_directory")
        self.actionAdd_current_file = QtWidgets.QAction(PinguinoIDE)
        self.actionAdd_current_file.setObjectName("actionAdd_current_file")
        self.actionAdd_existing_file = QtWidgets.QAction(PinguinoIDE)
        self.actionAdd_existing_file.setObjectName("actionAdd_existing_file")
        self.actionAdd_new_file = QtWidgets.QAction(PinguinoIDE)
        self.actionAdd_new_file.setObjectName("actionAdd_new_file")
        self.actionSubmit_bug_report = QtWidgets.QAction(PinguinoIDE)
        self.actionSubmit_bug_report.setObjectName("actionSubmit_bug_report")
        self.actionTabShell = QtWidgets.QAction(PinguinoIDE)
        self.actionTabShell.setCheckable(True)
        self.actionTabShell.setChecked(True)
        self.actionTabShell.setObjectName("actionTabShell")
        self.actionTabLog = QtWidgets.QAction(PinguinoIDE)
        self.actionTabLog.setCheckable(True)
        self.actionTabLog.setChecked(True)
        self.actionTabLog.setObjectName("actionTabLog")
        self.actionTabStdout = QtWidgets.QAction(PinguinoIDE)
        self.actionTabStdout.setCheckable(True)
        self.actionTabStdout.setChecked(True)
        self.actionTabStdout.setObjectName("actionTabStdout")
        self.actionTabFiles = QtWidgets.QAction(PinguinoIDE)
        self.actionTabFiles.setCheckable(True)
        self.actionTabFiles.setChecked(True)
        self.actionTabFiles.setObjectName("actionTabFiles")
        self.actionTabProject = QtWidgets.QAction(PinguinoIDE)
        self.actionTabProject.setCheckable(True)
        self.actionTabProject.setChecked(True)
        self.actionTabProject.setObjectName("actionTabProject")
        self.actionTabSourceBrowser = QtWidgets.QAction(PinguinoIDE)
        self.actionTabSourceBrowser.setCheckable(True)
        self.actionTabSourceBrowser.setChecked(True)
        self.actionTabSourceBrowser.setObjectName("actionTabSourceBrowser")
        self.actionTabSearch = QtWidgets.QAction(PinguinoIDE)
        self.actionTabSearch.setCheckable(True)
        self.actionTabSearch.setChecked(True)
        self.actionTabSearch.setObjectName("actionTabSearch")
        self.actionTabBoards = QtWidgets.QAction(PinguinoIDE)
        self.actionTabBoards.setCheckable(True)
        self.actionTabBoards.setChecked(True)
        self.actionTabBoards.setObjectName("actionTabBoards")
        self.actionToggle_vertical_tool_area = QtWidgets.QAction(PinguinoIDE)
        self.actionToggle_vertical_tool_area.setCheckable(True)
        self.actionToggle_vertical_tool_area.setObjectName("actionToggle_vertical_tool_area")
        self.actionToggle_horizontal_tool_area = QtWidgets.QAction(PinguinoIDE)
        self.actionToggle_horizontal_tool_area.setObjectName("actionToggle_horizontal_tool_area")
        self.actionMove_vertical_tool_area = QtWidgets.QAction(PinguinoIDE)
        self.actionMove_vertical_tool_area.setObjectName("actionMove_vertical_tool_area")
        self.actionGitPinguinoCompilers = QtWidgets.QAction(PinguinoIDE)
        self.actionGitPinguinoCompilers.setObjectName("actionGitPinguinoCompilers")
        self.actionReset_IDE_instalation = QtWidgets.QAction(PinguinoIDE)
        self.actionReset_IDE_instalation.setObjectName("actionReset_IDE_instalation")
        self.actionNew_blocks_file = QtWidgets.QAction(PinguinoIDE)
        icon14 = QtGui.QIcon()
        icon14.addPixmap(QtGui.QPixmap("../../../../../../../../pinguino-extra/resources/themes/pinguino11/icons/scalable/insert-object.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionNew_blocks_file.setIcon(icon14)
        self.actionNew_blocks_file.setObjectName("actionNew_blocks_file")
        self.actionAdd_new_blocks_file = QtWidgets.QAction(PinguinoIDE)
        self.actionAdd_new_blocks_file.setObjectName("actionAdd_new_blocks_file")
        self.actionHex = QtWidgets.QAction(PinguinoIDE)
        self.actionHex.setObjectName("actionHex")
        self.actionInsert_Block = QtWidgets.QAction(PinguinoIDE)
        self.actionInsert_Block.setObjectName("actionInsert_Block")
        self.actionGenerate_blocks = QtWidgets.QAction(PinguinoIDE)
        self.actionGenerate_blocks.setObjectName("actionGenerate_blocks")
        self.actionNew_library = QtWidgets.QAction(PinguinoIDE)
        self.actionNew_library.setObjectName("actionNew_library")
        self.actionTabPaths = QtWidgets.QAction(PinguinoIDE)
        self.actionTabPaths.setCheckable(True)
        self.actionTabPaths.setObjectName("actionTabPaths")
        self.actionExport_code_to_editor = QtWidgets.QAction(PinguinoIDE)
        self.actionExport_code_to_editor.setObjectName("actionExport_code_to_editor")
        self.menuRecents.addSeparator()
        self.menuFile.addAction(self.actionNew_file)
        self.menuFile.addAction(self.actionNew_blocks_file)
        self.menuFile.addAction(self.actionOpen_file)
        self.menuFile.addAction(self.menuRecents.menuAction())
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionSave_file)
        self.menuFile.addAction(self.actionSave_as)
        self.menuFile.addAction(self.actionSave_all)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionClose_file)
        self.menuFile.addAction(self.actionClose_all)
        self.menuFile.addAction(self.actionClose_others)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionPrint)
        self.menuFile.addSeparator()
        self.menuFile.addAction(self.actionQuit)
        self.menuEdit.addAction(self.actionUndo)
        self.menuEdit.addAction(self.actionRedo)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionCut)
        self.menuEdit.addAction(self.actionCopy)
        self.menuEdit.addAction(self.actionPaste)
        self.menuEdit.addAction(self.actionDelete)
        self.menuEdit.addAction(self.actionSelect_all)
        self.menuEdit.addSeparator()
        self.menuEdit.addAction(self.actionSearch)
        self.menuEdit.addAction(self.actionSearch_and_replace)
        self.menuEdit.addSeparator()
        self.menuPinguino.addAction(self.actionCompile)
        self.menuPinguino.addAction(self.actionUpload)
        self.menuPinguino.addAction(self.actionUpload_hex_directly)
        self.menuPinguino.addAction(self.actionIf_Compile_then_Upload)
        self.menuPinguino.addSeparator()
        self.menuPinguino.addAction(self.actionSelect_board)
        self.menuPinguino.addSeparator()
        self.menuPinguino.addAction(self.actionUser_c)
        self.menuPinguino.addAction(self.actionMain_c)
        self.menuPinguino.addAction(self.actionDefine_h)
        self.menuPinguino.addAction(self.actionHex)
        self.menuGitHub.addAction(self.actionGitPinguinoIde)
        self.menuGitHub.addAction(self.actionGitPinguinoLibraries)
        self.menuGitHub.addAction(self.actionGitPinguinoCompilers)
        self.menuLinks.addAction(self.menuGitHub.menuAction())
        self.menuLinks.addAction(self.actionWebsite)
        self.menuLinks.addAction(self.actionWiki)
        self.menuLinks.addAction(self.actionForum)
        self.menuLinks.addAction(self.actionBlog)
        self.menuLinks.addAction(self.actionGroup)
        self.menuLinks.addAction(self.actionShop)
        self.menuHelp.addAction(self.actionAbout)
        self.menuHelp.addAction(self.actionSubmit_bug_report)
        self.menuHelp.addSeparator()
        self.menuHelp.addAction(self.menuLinks.menuAction())
        self.menuSource.addAction(self.actionAutocomplete)
        self.menuSource.addAction(self.actionComment_out_region)
        self.menuSource.addAction(self.actionComment_Uncomment_region)
        self.menuSource.addAction(self.actionInsert_Block)
        self.menuSource.addSeparator()
        self.menuSource.addAction(self.actionIndent)
        self.menuSource.addAction(self.actionDedent)
        self.menuSource.addSeparator()
        self.menuSource.addAction(self.actionGenerate_blocks)
        self.menuIcons_theme.addAction(self.actionPinguino11)
        self.menuIcons_size.addAction(self.action16x16)
        self.menuIcons_size.addAction(self.action24x24)
        self.menuIcons_size.addAction(self.action32x32)
        self.menuIcons_size.addAction(self.action48x48)
        self.menuSettings.addAction(self.actionColor_theme)
        self.menuSettings.addAction(self.menuIcons_theme.menuAction())
        self.menuSettings.addAction(self.menuIcons_size.menuAction())
        self.menuSettings.addSeparator()
        self.menuSettings.addAction(self.actionReset_IDE_instalation)
        self.menuRecentProjects.addAction(self.action_list_recent)
        self.menuProject.addAction(self.actionNew_project)
        self.menuProject.addAction(self.actionNew_library)
        self.menuProject.addSeparator()
        self.menuProject.addAction(self.actionOpen_project)
        self.menuProject.addSeparator()
        self.menuProject.addAction(self.menuRecentProjects.menuAction())
        self.menuProject.addAction(self.actionSave_project)
        self.menuProject.addAction(self.actionSave_project_as)
        self.menuProject.addAction(self.actionClose_project)
        self.menuProject.addSeparator()
        self.menuProject.addAction(self.actionAdd_existing_directory)
        self.menuProject.addAction(self.actionAdd_current_file)
        self.menuProject.addAction(self.actionAdd_existing_file)
        self.menuProject.addAction(self.actionAdd_new_file)
        self.menuProject.addAction(self.actionAdd_new_blocks_file)
        self.menuTools.addAction(self.actionToggle_vertical_tool_area)
        self.menuTools.addAction(self.actionToggle_horizontal_tool_area)
        self.menuTools.addAction(self.actionMove_vertical_tool_area)
        self.menuTools.addAction(self.actionToolbars)
        self.menuTools.addAction(self.actionMenubar)
        self.menuTools.addSeparator()
        self.menuTools.addAction(self.actionTabShell)
        self.menuTools.addAction(self.actionTabLog)
        self.menuTools.addAction(self.actionTabStdout)
        self.menuTools.addAction(self.actionTabFiles)
        self.menuTools.addAction(self.actionTabProject)
        self.menuTools.addAction(self.actionTabSourceBrowser)
        self.menuTools.addAction(self.actionLibraryManager)
        self.menuTools.addAction(self.actionTabSearch)
        self.menuTools.addAction(self.actionTabBoards)
        self.menuTools.addAction(self.actionTabPaths)
        self.menubar.addAction(self.menuFile.menuAction())
        self.menubar.addAction(self.menuEdit.menuAction())
        self.menubar.addAction(self.menuProject.menuAction())
        self.menubar.addAction(self.menuSettings.menuAction())
        self.menubar.addAction(self.menuSource.menuAction())
        self.menubar.addAction(self.menuPinguino.menuAction())
        self.menubar.addAction(self.menuTools.menuAction())
        self.menubar.addAction(self.menuHelp.menuAction())
        self.toolBar.addAction(self.actionNew_file)
        self.toolBar.addAction(self.actionNew_blocks_file)
        self.toolBar.addAction(self.actionOpen_file)
        self.toolBar.addAction(self.actionSave_file)
        self.toolBar.addAction(self.actionUndo)
        self.toolBar.addAction(self.actionRedo)
        self.toolBar.addAction(self.actionCut)
        self.toolBar.addAction(self.actionCopy)
        self.toolBar.addAction(self.actionPaste)
        self.toolBar.addAction(self.actionSearch)
        self.toolBar.addAction(self.actionSelect_board)
        self.toolBar.addAction(self.actionCompile)
        self.toolBar.addAction(self.actionUpload)
        self.toolBar.addAction(self.actionSave_image)

        self.retranslateUi(PinguinoIDE)
        self.tabWidget_files.setCurrentIndex(-1)
        self.tabWidget_tools.setCurrentIndex(3)
        self.tabWidget_browser.setCurrentIndex(0)
        self.tabWidget_bottom.setCurrentIndex(1)
        QtCore.QMetaObject.connectSlotsByName(PinguinoIDE)
        PinguinoIDE.setTabOrder(self.tabWidget_browser, self.comboBox_files)
        PinguinoIDE.setTabOrder(self.comboBox_files, self.tableWidget_variables)
        PinguinoIDE.setTabOrder(self.tableWidget_variables, self.tableWidget_functions)
        PinguinoIDE.setTabOrder(self.tableWidget_functions, self.tableWidget_directives)

    def retranslateUi(self, PinguinoIDE):
        _translate = QtCore.QCoreApplication.translate
        self.menuFile.setTitle(_translate("PinguinoIDE", "&File"))
        self.menuRecents.setTitle(_translate("PinguinoIDE", "&Recents"))
        self.menuEdit.setTitle(_translate("PinguinoIDE", "&Edit"))
        self.menuHelp.setTitle(_translate("PinguinoIDE", "&Help"))
        self.menuLinks.setTitle(_translate("PinguinoIDE", "&Links"))
        self.menuGitHub.setTitle(_translate("PinguinoIDE", "&GitHub"))
        self.menuSource.setTitle(_translate("PinguinoIDE", "So&urce"))
        self.menuSettings.setTitle(_translate("PinguinoIDE", "Setti&ngs"))
        self.menuIcons_theme.setTitle(_translate("PinguinoIDE", "&Icons theme"))
        self.menuIcons_size.setTitle(_translate("PinguinoIDE", "Icons &size"))
        self.menuProject.setTitle(_translate("PinguinoIDE", "Pro&ject"))
        self.menuRecentProjects.setTitle(_translate("PinguinoIDE", "&Recent"))
        self.menuTools.setTitle(_translate("PinguinoIDE", "&Tools"))
        self.dockWidget_right.setWindowTitle(_translate("PinguinoIDE", "S&idebar"))
        self.comboBox_files.setItemText(0, _translate("PinguinoIDE", "Examples"))
        self.comboBox_files.setItemText(1, _translate("PinguinoIDE", "Current file directory"))
        self.comboBox_files.setItemText(2, _translate("PinguinoIDE", "Home"))
        self.comboBox_files.setItemText(3, _translate("PinguinoIDE", "Other..."))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Files), _translate("PinguinoIDE", "Files"))
        self.pushButton_compilelibrary.setText(_translate("PinguinoIDE", "Compile library"))
        self.pushButton_packagelibrary.setText(_translate("PinguinoIDE", "Package library"))
        self.pushButton_openproject.setText(_translate("PinguinoIDE", "Open project"))
        self.pushButton_newlibrary.setText(_translate("PinguinoIDE", "New Library"))
        self.pushButton_newproject.setText(_translate("PinguinoIDE", "New project"))
        self.treeWidget_projects.setSortingEnabled(False)
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Project), _translate("PinguinoIDE", "Project"))
        item = self.tableWidget_variables.horizontalHeaderItem(0)
        item.setText(_translate("PinguinoIDE", "File"))
        item = self.tableWidget_variables.horizontalHeaderItem(1)
        item.setText(_translate("PinguinoIDE", "Type"))
        self.tabWidget_browser.setTabText(self.tabWidget_browser.indexOf(self.Variables), _translate("PinguinoIDE", "Variables"))
        item = self.tableWidget_functions.horizontalHeaderItem(0)
        item.setText(_translate("PinguinoIDE", "File"))
        item = self.tableWidget_functions.horizontalHeaderItem(1)
        item.setText(_translate("PinguinoIDE", "Return"))
        item = self.tableWidget_functions.horizontalHeaderItem(2)
        item.setText(_translate("PinguinoIDE", "Args"))
        self.tabWidget_browser.setTabText(self.tabWidget_browser.indexOf(self.Functions), _translate("PinguinoIDE", "Functions"))
        item = self.tableWidget_directives.horizontalHeaderItem(0)
        item.setText(_translate("PinguinoIDE", "File"))
        item = self.tableWidget_directives.horizontalHeaderItem(1)
        item.setText(_translate("PinguinoIDE", "Type"))
        item = self.tableWidget_directives.horizontalHeaderItem(2)
        item.setText(_translate("PinguinoIDE", "Value"))
        self.tabWidget_browser.setTabText(self.tabWidget_browser.indexOf(self.Directives), _translate("PinguinoIDE", "Directives"))
        self.label_name.setText(_translate("PinguinoIDE", "Name:"))
        self.label_args.setText(_translate("PinguinoIDE", "Args:"))
        self.label_library.setText(_translate("PinguinoIDE", "Library:"))
        self.label_return.setText(_translate("PinguinoIDE", "Retutn:"))
        self.label_source_browser.setText(_translate("PinguinoIDE", "Move cursor over function to see details about it."))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.SourceBrowser), _translate("PinguinoIDE", "Source Browser"))
        self.label_2.setText(_translate("PinguinoIDE", "Architecture:"))
        self.radioButton_arch_8.setText(_translate("PinguinoIDE", "&8-bit"))
        self.radioButton_arch_32.setText(_translate("PinguinoIDE", "&32-bit"))
        self.label_7.setText(_translate("PinguinoIDE", "Compiler"))
        self.radioButton_compiler_xc8.setText(_translate("PinguinoIDE", "&XC8"))
        self.radioButton_compiler_sdcc.setText(_translate("PinguinoIDE", "SDCC"))
        self.radioButton_mode_usb.setText(_translate("PinguinoIDE", "USB"))
        self.radioButton_mode_bt.setText(_translate("PinguinoIDE", "Bluetooth"))
        self.label.setText(_translate("PinguinoIDE", "Programming mode:"))
        self.label_4.setText(_translate("PinguinoIDE", "Boards:"))
        self.label_5.setText(_translate("PinguinoIDE", "Boards:"))
        self.checkBox_mips16.setToolTip(_translate("PinguinoIDE", "<html><head/><body><p>Checked: Less memory but also less speed.<br>Unchecked: More memory but also increase speed.</p></body></html>"))
        self.checkBox_mips16.setText(_translate("PinguinoIDE", "Mips16"))
        self.label_6.setText(_translate("PinguinoIDE", "Advance options:"))
        self.label_9.setToolTip(_translate("PinguinoIDE", "<html><head/><body><p>-O2: The compiler will attempt to increase code performance without compromising on size, and without taking too much compilation time.</p><p>-O3: This is the highest level of optimization possible. It enables optimizations that are expensive in terms of compile time and memory usage, in many cases can slow down a system due to larger binaries and increased memory usage.</p><p>-Os: This option will optimize your code for size.</p></body></html>"))
        self.label_9.setText(_translate("PinguinoIDE", "Optimization:"))
        self.comboBox_optimization.setItemText(0, _translate("PinguinoIDE", "-O2"))
        self.comboBox_optimization.setItemText(1, _translate("PinguinoIDE", "-O3"))
        self.comboBox_optimization.setItemText(2, _translate("PinguinoIDE", "-Os"))
        self.label_8.setToolTip(_translate("PinguinoIDE", "<html><head/><body><p>The amount of memory allocated to objects that are being defined.</p></body></html>"))
        self.label_8.setText(_translate("PinguinoIDE", "Heap Size:"))
        self.spinBox_heapsize.setSuffix(_translate("PinguinoIDE", " bytes"))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Boards), _translate("PinguinoIDE", "Boards"))
        self.checkBox_case_sensitive.setText(_translate("PinguinoIDE", "Case sensitive"))
        self.label_search.setText(_translate("PinguinoIDE", "Search:"))
        self.label_replace.setText(_translate("PinguinoIDE", "Replace:"))
        self.pushButton_search_previous.setText(_translate("PinguinoIDE", "Previous"))
        self.pushButton_search_next.setText(_translate("PinguinoIDE", "Next"))
        self.pushButton_replace.setText(_translate("PinguinoIDE", "Replace"))
        self.pushButton_replace_all.setText(_translate("PinguinoIDE", "Replace all"))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Search), _translate("PinguinoIDE", "Search"))
        self.label_search_block.setText(_translate("PinguinoIDE", "Search block:"))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Blocks), _translate("PinguinoIDE", "Blocks"))
        self.checkBox_paths_default.setText(_translate("PinguinoIDE", "Use default paths"))
        self.groupBox_compilers.setTitle(_translate("PinguinoIDE", "Compilers"))
        self.label_10.setText(_translate("PinguinoIDE", "GCC bin:"))
        self.pushButton_dir_gcc.setText(_translate("PinguinoIDE", "..."))
        self.label_3.setText(_translate("PinguinoIDE", "SDCC bin:"))
        self.pushButton_dir_sdcc.setText(_translate("PinguinoIDE", "..."))
        self.label_11.setText(_translate("PinguinoIDE", "XC8 bin:"))
        self.pushButton_dir_xc8.setText(_translate("PinguinoIDE", "..."))
        self.groupBox_libraries.setTitle(_translate("PinguinoIDE", "Libraries"))
        self.label_13.setText(_translate("PinguinoIDE", "32bit libraries"))
        self.pushButton_dir_32bit.setText(_translate("PinguinoIDE", "..."))
        self.label_12.setText(_translate("PinguinoIDE", "8bit libraries"))
        self.pushButton_dir_8bit.setText(_translate("PinguinoIDE", "..."))
        self.label_14.setText(_translate("PinguinoIDE", "custom libraries"))
        self.pushButton_dir_libs.setText(_translate("PinguinoIDE", "..."))
        self.groupBox_icsp.setTitle(_translate("PinguinoIDE", "ICSP"))
        self.label_15.setText(_translate("PinguinoIDE", "MPLAB IPE"))
        self.pushButton_dir_mplab.setText(_translate("PinguinoIDE", "..."))
        self.tabWidget_tools.setTabText(self.tabWidget_tools.indexOf(self.Paths), _translate("PinguinoIDE", "Paths"))
        self.toolBar.setWindowTitle(_translate("PinguinoIDE", "Toolbar"))
        self.dockWidget_bottom.setWindowTitle(_translate("PinguinoIDE", "&Bottombar"))
        self.tabWidget_bottom.setTabText(self.tabWidget_bottom.indexOf(self.Shell), _translate("PinguinoIDE", "Python Shell"))
        self.tabWidget_bottom.setTabText(self.tabWidget_bottom.indexOf(self.Log), _translate("PinguinoIDE", "Log"))
        self.tabWidget_bottom.setTabText(self.tabWidget_bottom.indexOf(self.Stdout), _translate("PinguinoIDE", "Stdout"))
        self.toolBar_menu.setWindowTitle(_translate("PinguinoIDE", "Toolbar Menu"))
        self.actionNew_file.setText(_translate("PinguinoIDE", "&New file"))
        self.actionNew_file.setShortcut(_translate("PinguinoIDE", "Ctrl+N"))
        self.actionOpen_file.setText(_translate("PinguinoIDE", "&Open..."))
        self.actionOpen_file.setShortcut(_translate("PinguinoIDE", "Ctrl+O"))
        self.actionSave_file.setText(_translate("PinguinoIDE", "&Save"))
        self.actionSave_file.setShortcut(_translate("PinguinoIDE", "Ctrl+S"))
        self.actionClose_file.setText(_translate("PinguinoIDE", "&Close"))
        self.actionClose_file.setToolTip(_translate("PinguinoIDE", "Close file"))
        self.actionClose_file.setShortcut(_translate("PinguinoIDE", "Ctrl+W"))
        self.actionUndo.setText(_translate("PinguinoIDE", "&Undo"))
        self.actionUndo.setShortcut(_translate("PinguinoIDE", "Ctrl+Z"))
        self.actionRedo.setText(_translate("PinguinoIDE", "&Redo"))
        self.actionRedo.setShortcut(_translate("PinguinoIDE", "Ctrl+Y"))
        self.actionCut.setText(_translate("PinguinoIDE", "&Cut"))
        self.actionCut.setShortcut(_translate("PinguinoIDE", "Ctrl+X"))
        self.actionCopy.setText(_translate("PinguinoIDE", "C&opy"))
        self.actionCopy.setShortcut(_translate("PinguinoIDE", "Ctrl+C"))
        self.actionPaste.setText(_translate("PinguinoIDE", "&Paste"))
        self.actionPaste.setShortcut(_translate("PinguinoIDE", "Ctrl+V"))
        self.actionSearch.setText(_translate("PinguinoIDE", "S&earch"))
        self.actionSearch.setShortcut(_translate("PinguinoIDE", "Ctrl+F"))
        self.actionSearch_and_replace.setText(_translate("PinguinoIDE", "Searc&h and replace"))
        self.actionSearch_and_replace.setShortcut(_translate("PinguinoIDE", "Ctrl+R"))
        self.actionSelect_board.setText(_translate("PinguinoIDE", "&Pinguino boards"))
        self.actionSelect_board.setShortcut(_translate("PinguinoIDE", "Ctrl+Shift+B"))
        self.actionCompile.setText(_translate("PinguinoIDE", "&Compile"))
        self.actionCompile.setShortcut(_translate("PinguinoIDE", "F5"))
        self.actionUpload.setText(_translate("PinguinoIDE", "&Upload"))
        self.actionUpload.setShortcut(_translate("PinguinoIDE", "F6"))
        self.actionQuit.setText(_translate("PinguinoIDE", "&Quit"))
        self.actionQuit.setShortcut(_translate("PinguinoIDE", "Ctrl+Q"))
        self.actionAbout.setText(_translate("PinguinoIDE", "&About..."))
        self.actionComment_Uncomment_region.setText(_translate("PinguinoIDE", "Comment/&Uncomment region"))
        self.actionComment_Uncomment_region.setToolTip(_translate("PinguinoIDE", "Comment/Uncomment region"))
        self.actionComment_Uncomment_region.setShortcut(_translate("PinguinoIDE", "Ctrl+."))
        self.actionComment_out_region.setText(_translate("PinguinoIDE", "&Comment out region"))
        self.actionComment_out_region.setShortcut(_translate("PinguinoIDE", "Ctrl+/"))
        self.actionSave_image.setText(_translate("PinguinoIDE", "Save image"))
        self.actionSave_all.setText(_translate("PinguinoIDE", "Sav&e all"))
        self.actionClose_all.setText(_translate("PinguinoIDE", "C&lose all"))
        self.actionWebsite.setText(_translate("PinguinoIDE", "&Website"))
        self.actionWiki.setText(_translate("PinguinoIDE", "W&iki"))
        self.actionForum.setText(_translate("PinguinoIDE", "&Forum"))
        self.actionBlog.setText(_translate("PinguinoIDE", "&Blog"))
        self.actionGroup.setText(_translate("PinguinoIDE", "G&roup"))
        self.actionShop.setText(_translate("PinguinoIDE", "&Shop"))
        self.actionSave_as.setText(_translate("PinguinoIDE", "Sa&ve as..."))
        self.actionSave_as.setShortcut(_translate("PinguinoIDE", "Ctrl+Shift+S"))
        self.actionAutocomplete.setText(_translate("PinguinoIDE", "&Autocomplete code"))
        self.actionColor_theme.setText(_translate("PinguinoIDE", "&Background color"))
        self.actionLibraryManager.setText(_translate("PinguinoIDE", "Library ma&nager"))
        self.actionIndent.setText(_translate("PinguinoIDE", "I&ndent"))
        self.actionIndent.setShortcut(_translate("PinguinoIDE", "Ctrl+>"))
        self.actionDedent.setText(_translate("PinguinoIDE", "&Outdent"))
        self.actionDedent.setShortcut(_translate("PinguinoIDE", "Ctrl+<"))
        self.actionClose_others.setText(_translate("PinguinoIDE", "Close ot&hers"))
        self.actionDelete.setText(_translate("PinguinoIDE", "&Delete"))
        self.actionSelect_all.setText(_translate("PinguinoIDE", "&Select all"))
        self.actionPrint.setText(_translate("PinguinoIDE", "&Print..."))
        self.actionPrint.setShortcut(_translate("PinguinoIDE", "Ctrl+P"))
        self.actionToolbars.setText(_translate("PinguinoIDE", "&Toolbars"))
        self.actionIf_Compile_then_Upload.setText(_translate("PinguinoIDE", "&If Compile then Upload"))
        self.actionIf_Compile_then_Upload.setShortcut(_translate("PinguinoIDE", "F7"))
        self.actionGitPinguinoIde.setText(_translate("PinguinoIDE", "&pinguino-ide"))
        self.actionGitPinguinoLibraries.setText(_translate("PinguinoIDE", "pinguino-&libraries"))
        self.actionPinguino11.setText(_translate("PinguinoIDE", "&Pinguino11"))
        self.action16x16.setText(_translate("PinguinoIDE", "&16 x 16"))
        self.action24x24.setText(_translate("PinguinoIDE", "&24 x 24"))
        self.action32x32.setText(_translate("PinguinoIDE", "&32 x 32"))
        self.action48x48.setText(_translate("PinguinoIDE", "&48 x 48"))
        self.actionMain_c.setText(_translate("PinguinoIDE", "View &main.c"))
        self.actionDefine_h.setText(_translate("PinguinoIDE", "View &define.h"))
        self.actionUser_c.setText(_translate("PinguinoIDE", "&View user.c"))
        self.actionUpload_hex_directly.setText(_translate("PinguinoIDE", "Up&load .hex..."))
        self.actionMenubar.setText(_translate("PinguinoIDE", "M&enubar"))
        self.actionNew_project.setText(_translate("PinguinoIDE", "&New project..."))
        self.actionOpen_project.setText(_translate("PinguinoIDE", "&Open project or library..."))
        self.action_list_recent.setText(_translate("PinguinoIDE", "<&list recent>"))
        self.actionSave_project.setText(_translate("PinguinoIDE", "&Save project"))
        self.actionSave_project_as.setText(_translate("PinguinoIDE", "Save &project as..."))
        self.actionClose_project.setText(_translate("PinguinoIDE", "&Close project"))
        self.actionAdd_existing_directory.setText(_translate("PinguinoIDE", "&Add existing directory..."))
        self.actionAdd_current_file.setText(_translate("PinguinoIDE", "A&dd current file"))
        self.actionAdd_existing_file.setText(_translate("PinguinoIDE", "Add &existing file..."))
        self.actionAdd_new_file.setText(_translate("PinguinoIDE", "Add new &file..."))
        self.actionSubmit_bug_report.setText(_translate("PinguinoIDE", "&Submit bug report..."))
        self.actionTabShell.setText(_translate("PinguinoIDE", "&Python shell"))
        self.actionTabLog.setText(_translate("PinguinoIDE", "&Logs"))
        self.actionTabStdout.setText(_translate("PinguinoIDE", "&Stdout"))
        self.actionTabFiles.setText(_translate("PinguinoIDE", "&Files"))
        self.actionTabProject.setText(_translate("PinguinoIDE", "P&rojects"))
        self.actionTabSourceBrowser.setText(_translate("PinguinoIDE", "S&ource browser"))
        self.actionTabSearch.setText(_translate("PinguinoIDE", "Sear&ch"))
        self.actionTabBoards.setText(_translate("PinguinoIDE", "&Boards"))
        self.actionToggle_vertical_tool_area.setText(_translate("PinguinoIDE", "&Hide Vertical tool area"))
        self.actionToggle_vertical_tool_area.setShortcut(_translate("PinguinoIDE", "F2"))
        self.actionToggle_horizontal_tool_area.setText(_translate("PinguinoIDE", "H&ide horizontal tool area"))
        self.actionToggle_horizontal_tool_area.setShortcut(_translate("PinguinoIDE", "F3"))
        self.actionMove_vertical_tool_area.setText(_translate("PinguinoIDE", "&Move vertical tool area to right"))
        self.actionGitPinguinoCompilers.setText(_translate("PinguinoIDE", "pinguino-&compilers"))
        self.actionReset_IDE_instalation.setText(_translate("PinguinoIDE", "&Reset IDE configuration"))
        self.actionNew_blocks_file.setText(_translate("PinguinoIDE", "New &blocks file"))
        self.actionNew_blocks_file.setShortcut(_translate("PinguinoIDE", "Ctrl+Shift+N"))
        self.actionAdd_new_blocks_file.setText(_translate("PinguinoIDE", "Add new &blocks file..."))
        self.actionHex.setText(_translate("PinguinoIDE", "View .&hex"))
        self.actionInsert_Block.setText(_translate("PinguinoIDE", "&Insert block"))
        self.actionInsert_Block.setShortcut(_translate("PinguinoIDE", "Ctrl+I"))
        self.actionGenerate_blocks.setText(_translate("PinguinoIDE", "&Generate blocks"))
        self.actionNew_library.setText(_translate("PinguinoIDE", "New &library..."))
        self.actionTabPaths.setText(_translate("PinguinoIDE", "Paths"))
        self.actionExport_code_to_editor.setText(_translate("PinguinoIDE", "Export code to editor")) class PythonShell(object):

    def __init__(self):

        self.main.plainTextEdit_output = PinguinoTextEdit()
        self.main.plainTextEdit_output.set_extra_args(**{"pinguino": self})
        self.main.gridLayout_shell.addWidget(self.main.plainTextEdit_output, 0, 0, 1, 1) class Log(object):

    def __init__(self):

        self.main.plainTextEdit_log = PinguinoTextEdit(shell=False)
        self.main.plainTextEdit_log.setReadOnly(True)
        self.main.gridLayout_log.addWidget(self.main.plainTextEdit_log, 0, 0, 1, 1)


    #----------------------------------------------------------------------
    def enable_debugger(self):

        log = logging.getLogger()
        log.setLevel(logging.DEBUG)
        ch = logging.StreamHandler(self.main.plainTextEdit_log)
        formatter = logging.Formatter("[%(levelname)s] %(message)s")
        # formatter = logging.Formatter("[{levelname}] {message}")
        ch.setFormatter(formatter)
        log.addHandler(ch)


    #----------------------------------------------------------------------
    def write_log(self, data, prefix="[INFO]"):

        lines = ""
        if type(data) == type({}):
            line = key + ": " + kwargs[key]
            lines += line
        else:
            lines = data

        self.main.plainTextEdit_log.write(lines, prefix=prefix) class Stdout(object):
    """"""

    #----------------------------------------------------------------------
    @Decorator.alert_tab("Stdout")
    def update_stdout(self):
        """"""
        file_ = os.path.join(os.getenv("PINGUINO_USER_PATH"), "source", "stdout")

        self.main.plainTextEdit_stdout.moveCursor(QtGui.QTextCursor.End)

        intro = "\n" * 2 + str(datetime.now()) + "\n" + "#" * 70 + "\n"
        self.main.plainTextEdit_stdout.insertPlainText(intro)

        if os.path.exists(file_):
            #RB20170215 : fixed a UnicodeDecodeError by adding errors='ignore'
            #Note : codecs.open() returns a file object that will encode unicode values to UTF-8
            #stdout = codecs.open(file_, "r", encoding="utf-8")
            stdout = codecs.open(file_, "r", encoding='utf-8', errors='ignore')
            content = stdout.readlines()
            stdout.close()
            self.main.plainTextEdit_stdout.insertPlainText("".join(content))
            self.main.plainTextEdit_stdout.moveCursor(QtGui.QTextCursor.EndOfLine)

        self.main.plainTextEdit_stdout.moveCursor(QtGui.QTextCursor.End)
        self.main.plainTextEdit_stdout.insertPlainText("\n"*4)
import sys
import os
import platform
import inspect
import types
import logging
from PySide2 import QtGui, QtCore, QtWidgets
from .commons.backgrounds import BackgroundPallete
from .events import PinguinoEvents
from .methods.decorators import Decorator
from .custom_widgets.code_editor.autocomplete_icons import CompleteIcons
from .custom_widgets.code_editor.autocompleter import PinguinoAutoCompleter
from ..gide.app.graphical import GraphicalIDE
from ..pinguino_core.pinguino import Pinguino, AllBoards
from ..pinguino_core.pinguino_config import PinguinoConfig
from ..pinguino_core.config import Config
from ..frames.main import Ui_PinguinoIDE
from .tools.python_shell import PythonShell
from .tools.log import Log
from .tools.stdout import Stdout
#!/usr/bin/env python
#-*- coding: utf-8 -*-



# from .custom_widgets import PinguinoTextEdit
#from .help.help import Help
# from .methods.widgets_features import PrettyFeatures

#import debugger


########################################################################
class PinguinoIDE(QtWidgets.QMainWindow, PinguinoEvents, PythonShell, Log, Stdout):

    #@Decorator.debug_time()
    def __init__(self, splash_write):
        super(PinguinoIDE, self).__init__()

        os.environ["PINGUINO_PROJECT"] = ""

        #QtCore.QTextCodec.setCodecForCStrings(QtCore.QTextCodec.codecForName("UTF-8"))
        #QtCore.QTextCodec.setCodecForLocale(QtCore.QTextCodec.codecForName("UTF-8"))
        #QtCore.QTextCodec.setCodecForTr(QtCore.QTextCodec.codecForName("UTF-8"))

        self.main = Ui_PinguinoIDE()
        self.main.setupUi(self)

        # self.argvs = argvs

        # if not self.argvs.devmode:
            # self.main.menubar.removeAction(self.main.menuDevelopment.menuAction())

        splash_write(QtWidgets.QApplication.translate("Splash", "Setting enviroment values"))
        PinguinoConfig.set_environ_vars()
        splash_write(QtWidgets.QApplication.translate("Splash", "Checking user files"))
        PinguinoConfig.check_user_files()

        splash_write(QtWidgets.QApplication.translate("Splash", "Loading Pinguino Core"))
        self.pinguinoAPI = Pinguino()
        self.pinguinoAPI._boards_ = AllBoards

        splash_write(QtWidgets.QApplication.translate("Splash", "Loading configuration"))

        self.configIDE = Config()