Esempio n. 1
0
 def seleciona_individuo_cruzamento(self):
     melhor = float('inf')
     melhor_individuo = self.copia_populacao[0]
     for individuo in self.copia_populacao:
         individuo_AF = Tab(individuo).AF()
         if (individuo_AF < melhor and random.random() <
             (individuo_AF / self.soma_AF())):
             print("teste")
             melhor = Tab(individuo).AF()
             melhor_individuo = individuo
     return melhor_individuo
Esempio n. 2
0
def diveg():
  the=about.defaults()
  t=Tab(file=the.data)
  print(the.data)
  for _ in  range(10):
    print("")
    keys(t,the)
Esempio n. 3
0
    def __init__(self):
        self.root = tk.Tk()
        self.root.title("Flash")
        self.label = tk.Label(
            self.root,
            width=self.root.winfo_reqwidth(),
            height=self.root.winfo_reqheight(),
            text="Create new file",
        )
        self.tab = Tab(self.root)
        self.txt, self.tb = self.tab.add_tab("untitled")
        self.height, self.width = (
            self.root.winfo_reqheight(),
            self.root.winfo_reqwidth(),
        )
        self.txt.config(
            height=self.height,
            width=self.width,
        )
        self.footer = tk.Label(self.root)

        self.footer.pack(fill="both", expand="yes", side=tk.BOTTOM)
        self.txt.pack(fill="both", expand="yes")
        self.tb.pack(fill="both", expand="yes")
        self.label.pack()
        self.root.geometry("998x646")
        self.root.minsize(width=400, height=200)
Esempio n. 4
0
    def addTab(self):

        text, ok = QInputDialog.getText(self, 'Name your tab', 'Name')
        if ok:
            name = str(text)
            widget = Tab(self)
            self.tab_widget.addTab(widget, name)
            self.tab_widget.setCurrentWidget(widget)
Esempio n. 5
0
    def read(self, index):
        putanja = self.dock.model.filePath(index)
        if os.path.isdir(putanja):
            return

        ista_putanja = False
        for i in range(len(self.lista_putanja)):
            if putanja == self.lista_putanja[i]:
                ista_putanja = True
                return
        if not ista_putanja:
            self.lista_putanja.append(putanja)
            if putanja.find(".sql") != -1:
                self.connection = mysql.connector.connect(user="******", password="******", host="127.0.0.1", database="projekat")
                self.csor = self.connection.cursor()
                putanja = "podaci\metaPodaci\projekat_meta_podaci.csv"
                meta_podaci = citanje_meta_podataka(putanja, True)
                self.imena_tabela = meta_podaci[4].split(",")

                self.treeView = QTreeView()
                self.treeView.setContextMenuPolicy(Qt.CustomContextMenu)
                self.treeView.customContextMenuRequested.connect(self.dugme_baza)
                
                model = QStandardItemModel(parent=self.dock.tree.sub_layout)
                item = QStandardItem("zatvori")
                item.setEditable(False)
                model.appendRow(item)
                for text in self.imena_tabela:
                    item = QStandardItem(text)
                    item.setEditable(False)
                    model.appendRow(item)
                
                self.treeView.setModel(model)
                self.treeView.clicked.connect(self.dugme_baza)
                self.treeView.PositionAtBottom

                si = self.dock.tree.sub_layout.sizeHint()
                si.setWidth(self.dock.width())
                si.setHeight(200)
                self.treeView.setFixedSize(si.width(), si.height())

                self.treeView.setHeaderHidden(True)
                self.dock.tree.sub_layout.addWidget(self.treeView)
                self.dock.tree.sub_layout.setAlignment(self.treeView, QtCore.Qt.AlignBottom)
                return

            tab = Tab(putanja, parent=self.central_widget)
            tab.pocetna_strana = self

            if putanja != "":
                tab.read()
            else:
                tab.read(putanja)
            tab.btn_down.clicked.connect(self.otvori_tabelu_dete)
            tab.btn_up.clicked.connect(self.otvori_tabelu_roditelj)
            tab.naziv = tab.meta_podaci[0]
            self.central_widget.addTab(tab, tab.naziv)
            self.central_widget.setCurrentIndex(self.central_widget.currentIndex()+1)
Esempio n. 6
0
    def dugme_baza(self, model_indeks):
        indeks = model_indeks.row()
        if indeks == 0:
            self.treeView.close()
            for i in range(len(self.lista_putanja)):
                if self.lista_putanja[i].find(".sql") != 1:
                    self.lista_putanja.pop(i)
                    break

            self.central_widget.setCurrentIndex(indeks)
            brojac = 0
            while len(self.lista_baza) != 0:
                tab = self.central_widget.currentWidget()
                if tab.is_baza:
                    for i in range(brojac, len(self.lista_baza)):
                        if self.lista_baza[brojac] == tab.indeks:
                            self.lista_baza.pop(brojac)
                            self.central_widget.removeTab(indeks)
                            break
                        else:
                            brojac += 1
                else:
                    indeks += 1
                    self.central_widget.setCurrentIndex(indeks)

            self.csor.close()
            self.connection.close()
            return
        else:
            indeks -= 1
            for i in range(len(self.lista_baza)):
                if self.lista_baza[i] == indeks:
                    return
            self.lista_baza.append(indeks)

        tab = Tab(parent=self.central_widget)
        tab.pocetna_strana = self
        tab.indeks = indeks
        tab.naziv = self.imena_tabela[indeks]
        
        nova_putanja = "podaci\\metaPodaci\\"
        nova_putanja += self.imena_tabela[indeks][0].lower()
        
        for s in range(1, len(self.imena_tabela[indeks])):
            if self.imena_tabela[indeks][s].isupper():
                nova_putanja += "_" + self.imena_tabela[indeks][s].lower()
            else:
                nova_putanja += self.imena_tabela[indeks][s]
        
        nova_putanja += "_meta_podaci_sql.csv"

        tab.read(nova_putanja)
        tab.btn_down.clicked.connect(self.otvori_tabelu_dete)
        tab.btn_up.clicked.connect(self.otvori_tabelu_roditelj)
        self.central_widget.addTab(tab, tab.naziv)
        self.central_widget.setCurrentIndex(self.central_widget.currentIndex()+1)
Esempio n. 7
0
 def append(self, window):
     Frame.append(self, window)
     tab = Tab(self, window)
     window.tab = tab
     self.tabs.append(tab)
     if not self.visible():
         tab.hide()
     tab.set_text(window.get_title())
     # shouldn't some of the stuff above be moved into tab_manage?
     window.tab_manage()
Esempio n. 8
0
def test_sort():
    "make a table"
    t = Tab(csv("../data/auto93.csv"))
    tmp = ordered(t.rows(), t.cols)
    for col in t.cols.y:
        print(col.txt, col.mid(), col.sd() * .35)
    for one in tmp[:5]:
        print(t.cols.ys(one))
    print("")
    for one in tmp[-5:]:
        print(t.cols.ys(one))
Esempio n. 9
0
def diveg(f="data/weather.csv",loud=False):
  the=about.defaults()
  t=Tab(file=f)
  all = sorted(t.rows)
  for x in all: print(x.y())
  return 1
  c=Clusters(t,the,cols=t.cols.y, loud=loud)
  print([col.txt for col in t.cols.y])
  all = sorted(c.all)
  for t1 in c.all: print(rs(t1.y()))
  for span in all[0].bins(all[-1],the): print(span)
  print(the)
Esempio n. 10
0
def diveg(f="data/weather.csv", loud=False):
    the = about.defaults()
    t = Tab(file=f)
    if len(t.rows) > 2000: the.tiny = 0.66
    all = sorted(clusters.div(t, the, cols=t.cols.x, loud=True))
    print([col.txt for col in t.cols.y])
    print(rs(t.y(), 3), "<== baseline")
    for x in all:
        print(rs(x.y(), 3))
    for span in sorted(all[0].bins(all[-1], the)):
        print(span)
    print(round(random.random(), 3), the)
Esempio n. 11
0
def go(f="data/weather.csv",silent=True):
  the=about.defaults()
  t=Tab(file=f)
  for n,here in enumerate(t.rows):
    tmp=t.around(here,the)
    me= tmp[0][1]
    close  = tmp[1][1]
    far = t.far(here,the)
    further= tmp[-1][1]
    if not silent:
      print("")
      print(n,here.cells)
      print(n,me.cells)
      print(n,far.cells)
      print(n,further.cells)
    assert tmp[0][0] <= tmp[1][0] < tmp[-1][0]
Esempio n. 12
0
    def __init__(self, root, **kwargs):

        # Class variable initialization
        self._root = root
        self._config = root._config
        self._tabs = {}

        # Initialize notebook widget
        new_widget(root, super(), **kwargs)

        # Add tabs to notebook
        for tab in self._config.get_tab_names():
            self._tabs[tab] = Tab(self, **kwargs)
            self.add(self._tabs[tab], text=tab)

        return None
Esempio n. 13
0
    def Add(self, page, focus, resort = True):
        """
            Adds a tab to the bar.  Should only be used by parent NoteBook.
            page - page in PageContainer the tab is to be associated with
            focus - whether that tab should steal focus from current tab
        """
        tab = Tab(self, page, skinkey = self.tabskin)
        tab.Bind(wx.EVT_CONTEXT_MENU, self.ShowMenu)
        tab.Show(False)
        self.tabs.append(tab)

        if focus:
            wx.CallAfter(tab.SetActive, True)

        elif resort:
            if self.side_tabs:
                self.ReVgenerate()
            else:
                self.Regenerate(True)

        return tab
Esempio n. 14
0
    def add_tab_page(self):
        """Add a new empty tab.

        Create empty query panel and empty result table.
        """
        empty_tab = Tab()
        self.latest_query_index += 1
        self.addTab(empty_tab,
                    'Query {idx}'.format(idx=self.latest_query_index))
        if self.tabBar().count() > 1:
            current_tab_gdb = getattr(self.widget(self.currentIndex()), 'gdb',
                                      None)
            if current_tab_gdb:
                empty_tab.gdb = current_tab_gdb
                empty_tab.connected_gdb_path_label.setText(
                    self.widget(self.currentIndex()).gdb.path)
                empty_tab.connect_to_geodatabase(evt=None,
                                                 triggered_with_browse=False)
                empty_tab._fill_toc()
            else:  # the first tab
                empty_tab.connected_gdb_path_label.setText(
                    not_connected_to_gdb_message)

        # focus on the newly added tab
        self.setCurrentWidget(empty_tab)
        # focus on the query text panel to be able to start typing directly
        empty_tab.query.setFocus()

        if dev_mode:
            empty_tab.gdb = Geodatabase('NYC.gdb')
            empty_tab.connected_gdb_path_label.setText(empty_tab.gdb.path)
            empty_tab._set_gdb_items_highlight()
            empty_tab._fill_toc()
            empty_tab.query.setText('select * from streets limit 1000')
            empty_tab.run_query()
        return
Esempio n. 15
0
 def soma_AF(self):
     soma = 0
     for individuo in self.populacao:
         soma += Tab(individuo).AF()
     return soma
Esempio n. 16
0
 def setUpClass(self):
     username = os.getenv(constants.USERNAME,"")
     password = os.getenv(constants.PASSWORD,"")
     """Start web browser"""
     self._browser = Tab()
     self._browser.login_on_page(constants.DERA_SCM_URL, username, password)
Esempio n. 17
0
 def crear_tab(self, url, nombre):
     new_tab = Tab(url, nombre)
     self.tabs[nombre] = new_tab
Esempio n. 18
0
    def initialize_variables(self):
        # define display surface
        self.dimensions = (1080, 600)
        # Initial parameters
        self.subsumption = True
        self.episode_num = 0
        self.extra = False
        self.agent_num = 0
        self.placing_object = False
        self.rotate_unplaced = 0
        self.continuous = True
        self.draw_goal = False
        self.wolf = True
        self.randomness = 5
        self.reference = 20
        self.draw_scaleable = False
        self.display = [False, False, False]
        self.training = False
        self.running = False
        self.custom_build = False
        self.paused = False
        self.agents_to_be_added = []

        # Backgrounds colour
        self.background = (0, 153, 255, 221)

        # Keeps track of the winrate across training stages
        self.win_counter = 0
        self.network_collection = NetworkCollection()
        # Place window in the center of the screen
        os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (150, 80)
        # initialise display
        pygame.init()
        self.clock = pygame.time.Clock()
        self.canvas = pygame.display.set_mode(self.dimensions)
        pygame.display.set_caption("Intelligent Agent Structures")
        # Create a font used to write on the screen
        pygame.font.init()
        self.font = pygame.font.SysFont('arial', 12)
        self.font.set_bold(True)

        # Get the image resources for the world
        self.pointers = [None, None]
        self.pointers[0] = pygame.image.load(
            "image_resources/pointer_alt.png").convert_alpha()
        self.pointers[1] = pygame.image.load(
            "image_resources/pointer.png").convert_alpha()

        # array containing the environments current blocks and agents
        self.blocks, self.agents = [], []
        # Adds agents into the world
        self.floor = Object(0, (0, 400))
        self.floor.load_image("image_resources/flat_floor.png")

        # File paths for the block images
        self.block_images = [
            "300x200", "200x600", "400x400", "200x200", "goal", "goal_flipped"
        ]

        # UI Tabs for environment modification, output log and controls
        self.tabs = []
        self.tabs.append(Options(0, self))
        self.tabs.append(Log(1, self.font, self))
        self.tabs.append(Tab(2))

        # Static agents used in the final training stage
        self.scaleable_agents = []
        preset_rotations = [
            44, 0, 270, 90, 90, 90, 0, 0, 0, 90, 90, 90, 0, 0, 0
        ]
        self.scaleable_agents.append(
            Agent((582, 339), self.network_collection, 0, None, 25, False,
                  self.randomness, self.subsumption))
        self.scaleable_agents.append(
            Agent((667, 339), self.network_collection, 0, None, 25, False,
                  self.randomness, self.subsumption))
        self.scaleable_agents.append(
            Agent((667, 304), self.network_collection, 0, None, 25, False,
                  self.randomness, self.subsumption))
        for i in range(3):
            self.scaleable_agents[i].parts.set_rotations(preset_rotations)
        # Rounds won/lost
        self.won = 0
        self.lost = 0
Esempio n. 19
0
    def setUpClass(self):

        username = os.getenv(constants.USERNAME,"")
        password = os.getenv(constants.PASSWORD,"")
        """Start web browser"""
        self._home_page = Tab()
Esempio n. 20
0
from tab import Tab
from tab import Note
from tab import const

if __name__ == '__main__':
    notes = [
        Note("C3", const.QUARTER),
        Note("D3", const.QUARTER),
        Note("E3", const.QUARTER),
        Note("F3", const.QUARTER),
        Note("G3", const.QUARTER),
        Note("A3", const.QUARTER),
        Note("B3", const.QUARTER),
        Note("C4", const.QUARTER),
        Note("C3", const.QUARTER),
        Note("D3", const.QUARTER),
        Note("E3", const.QUARTER),
        Note("F3", const.QUARTER),
        Note("G3", const.QUARTER),
        Note("A3", const.QUARTER),
        Note("B3", const.QUARTER),
        Note("C4", const.QUARTER)
    ]

    tab = Tab(notes)
    tab.generate()
Esempio n. 21
0
import numpy as np
#from SA import SA
#from HC import HC
from tab import Tab
from GA import GA

#queen = [5,3,2,1,4,0]         Coluna da rainha da linha i.
#                              Nesse exemplo a rainha da linha 0 estaria 
#                              na coluna 5, a rainha da linha 1 na coluna 3
#i x v[i]

if __name__ == '__main__':
    n = 40
    ##---------------------SA-----------------##
    queens = np.arange(0,n)
    tab = Tab(queens)
#    
#    sa = SA(tab,0.000001,4000)
#    aval,tab = sa.run()
#    print('aval=',aval)
#    print(tab)
        
    ga = GA(tab,10,20,0.01)
    pi = ga.populacao_inicial()
    ga.seleciona_individuo_cruzamento()
    ga.crossover()
    
    
    #tabSA = tab.tabuleiro()
    
    ##---------------------HC-----------------##
Esempio n. 22
0
    def otvori_tabelu_roditelj(self):
        if self.central_widget.currentWidget() == None:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Trenutno nijedna datoteka nije otvorena!")
            poruka.exec_()
            return
        elif not hasattr(self.central_widget.currentWidget().table, "selected_elem"):
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Trenutno nijedan element nije selektovan!")
            poruka.exec_()
            return

        model = self.central_widget.currentWidget().table.model()
        element_selected = model.get_element(self.central_widget.currentWidget().table.selected_elem)
        veze = []
        veze = self.central_widget.currentWidget().meta_podaci[9].split(",")
        meta_podaci = self.central_widget.currentWidget().meta_podaci
        lista_kljuceva = []
        brojac = len(veze)-1
        lista_roditelja = []

        for i in range(len(veze)):
            if veze[brojac].find("parent_") == -1:
                veze.pop(brojac)
                brojac -= 1
            else:
                lista_roditelja.append(veze[brojac])
                brojac -= 1
        index = -1

        if len(lista_roditelja) == 0:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Selektovani element nema roditelja!")
            poruka.exec_()
            return

        elif len(lista_roditelja) > 1:
            list_tuple = ()
            for i in range(len(lista_roditelja)):
                del1 = lista_roditelja[i].find("_")+1
                del2 = lista_roditelja[i].find("(")
                ime = lista_roditelja[i][del1:del2]

                list_tuple = list_tuple + (ime,)

            input = QtWidgets.QInputDialog.getItem(
                self,
                "Izbor",
                "Trenutna tabela ima vise od 1 roditelja\nIzaberite roditelja:",
                list_tuple,
                0,
                editable=False)
                
            if input[1]:
                for i in range(len(lista_roditelja)):
                    if lista_roditelja[i].find(input[0]) != -1:
                        index = i
                        break
            else:
                return

        elif len(lista_roditelja) == 1:
            index = 0

        if index == -1:
            return
            
        del1 = lista_roditelja[index].find("_")+1
        lista_roditelja[index] = lista_roditelja[index][del1:len(lista_roditelja[index])]
        del1 = lista_roditelja[index].find("(")
        ime_roditelja = lista_roditelja[index][0:del1]
        nova_putanja = ime_roditelja[0].lower()
        
        for s in range(1, len(ime_roditelja)):
            if ime_roditelja[s].isupper():
                nova_putanja += "_" + ime_roditelja[s].lower()
            else:
                nova_putanja += ime_roditelja[s]
                
        
        nova_putanja = meta_podaci[2] + "\\" + nova_putanja
        if meta_podaci[1] == "serijska":
            nova_putanja += "_ser."
            
        elif meta_podaci[1] == "sekvencijalna":
            nova_putanja += "_sek."
            
        elif meta_podaci[1] == "sql":
            nova_putanja += "_meta_podaci_sql."

        nova_putanja += meta_podaci[3]
        
        del1 = lista_roditelja[index].find("(") + 1
        del2 = lista_roditelja[index].find(")")
        lista_kljuceva.append(lista_roditelja[index][del1:del2].split("#"))
        
        if self.central_widget.currentWidget().is_baza:
            tab = Tab(parent=self.central_widget)
            tab.pocetna_strana = self
            tab.naziv = ime_roditelja
            indeks = 0
            for i in range(len(self.imena_tabela)):
                if self.imena_tabela[i] == ime_roditelja:
                    indeks = i
                    break
            for i in range(len(self.lista_baza)):
                if self.lista_baza[i] == self.central_widget.currentWidget().indeks:
                    self.lista_baza.pop(i)
                    break
            tab.indeks = indeks
            tab.read(nova_putanja)
        else:
            tab = Tab(nova_putanja, self.central_widget)
            tab.pocetna_strana = self
            tab.read()

        indeks_roditelja = -1
        for j in range(len(tab.table.model().lista_prikaz)):
            pronadjen = True
            for m in range(len(lista_kljuceva[len(lista_kljuceva)-1])):
                kljucevi = lista_kljuceva[len(lista_kljuceva)-1][m].split("=")
                if len(kljucevi) == 1:
                    if element_selected.__getattribute__(kljucevi[0]) != tab.table.model().lista_prikaz[j].__getattribute__(kljucevi[0]):
                        pronadjen = False
                elif len(kljucevi) == 2:
                    if element_selected.__getattribute__(kljucevi[0]) != tab.table.model().lista_prikaz[j].__getattribute__(kljucevi[1]):
                        pronadjen = False
                else:
                    print("pocetna_strana.py, 124 linija, eror u len(klucevi):", len(kljucevi), "// ", kljucevi)
            if pronadjen:
                indeks_roditelja = j
                break
        
        if indeks_roditelja == -1:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Selektovani element nema roditelja sa istim kljucem kao kod selektovanog!")
            poruka.exec_()
            return

        tab.table.selectRow(indeks_roditelja)
        top = tab.table.currentIndex()
        tab.element_selected(top)

        # tab.table.setModel(tab.table.model())

        tab.btn_down.clicked.connect(self.otvori_tabelu_dete)
        tab.btn_up.clicked.connect(self.otvori_tabelu_roditelj)
        # tab.btn_left.clicked.connect(self.otvori_tabelu_levi_rodjak)
        # tab.btn_right.clicked.connect(self.otvori_tabelu_desni_rodjak)

        self.central_widget.removeTab(self.central_widget.currentIndex())
        self.central_widget.addTab(tab, ime_roditelja)

        meta = ""
        for s in range(len(self.central_widget.currentWidget().meta_podaci[0])):
            if self.central_widget.currentWidget().meta_podaci[0][s].isupper():
                meta += "_" + self.central_widget.currentWidget().meta_podaci[0][s].lower()
            else:
                meta += self.central_widget.currentWidget().meta_podaci[0][s]
                
        meta = meta[1:len(meta)]
        meta = self.central_widget.currentWidget().meta_podaci[2] + "\\" + meta
        if self.central_widget.currentWidget().meta_podaci[1] == "serijska":
            meta += "_ser."
            
        elif self.central_widget.currentWidget().meta_podaci[1] == "sekvencijalna":
            meta += "_sek."
            
        elif self.central_widget.currentWidget().meta_podaci[1] == "sql":
            meta += "_meta_podaci_sql."

        meta += self.central_widget.currentWidget().meta_podaci[3]
        
        self.lista_putanja.append(meta)
        self.lista_putanja.remove(self.lista_putanja[self.central_widget.currentIndex()])
Esempio n. 23
0
    def otvori_tabelu_dete(self):
        if self.central_widget.currentWidget() == None:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Trenutno nijedna datoteka nije otvorena!")
            poruka.exec_()
            return
        elif not hasattr(self.central_widget.currentWidget().table, "selected_elem"):
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Trenutno nijedan element nije selektovan!")
            poruka.exec_()
            return
        elif self.central_widget.currentWidget().tab_widget.currentWidget() == None:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Selektovani element nema podtabele!")
            poruka.exec_()
            return
        elif len(self.central_widget.currentWidget().tab_widget.currentWidget().model.lista_prikaz) == 0:
            poruka = QMessageBox()
            icon = QtGui.QIcon("src/ikonice/logo.jpg")
            poruka.setWindowIcon(icon)
            poruka.setWindowTitle("Upozorenje!")
            poruka.setText("Selektovani element nema decu u selektovanoj podtabeli!")
            poruka.exec_()
            return

        child = self.central_widget.currentWidget().tab_widget.currentWidget()
        if self.central_widget.currentWidget().is_baza:
            tab = Tab(parent=self.central_widget)
            tab.pocetna_strana = self
            tab.naziv = child.naziv
            indeks = 0
            for i in range(len(self.imena_tabela)):
                if self.imena_tabela[i] == child.naziv:
                    indeks = i
                    break
            for i in range(len(self.lista_baza)):
                if self.lista_baza[i] == self.central_widget.currentWidget().indeks:
                    self.lista_baza.pop(i)
                    break
            tab.indeks = indeks
            # self.lista_baza.append(indeks)
            tab.read(child.putanja)
        else:
            tab = Tab(child.putanja, self.central_widget)
            tab.pocetna_strana = self
            tab.read()
        tab.table.model().lista_prikaz = child.model.lista_prikaz
        
        tab.btn_down.clicked.connect(self.otvori_tabelu_dete)
        tab.btn_up.clicked.connect(self.otvori_tabelu_roditelj)

        self.central_widget.removeTab(self.central_widget.currentIndex())
        self.central_widget.addTab(tab, child.meta_podaci[0])

        meta = ""
        for s in range(len(child.meta_podaci[0])):
            if child.meta_podaci[0][s].isupper():
                meta += "_" + child.meta_podaci[0][s].lower()
            else:
                meta += child.meta_podaci[0][s]
                
        meta = meta[1:len(meta)]
        meta = child.meta_podaci[2] + "\\" + meta
        if child.meta_podaci[1] == "serijska":
            meta += "_ser."
            
        elif child.meta_podaci[1] == "sekvencijalna":
            meta += "_sek."
            
        elif child.meta_podaci[1] == "sql":
            meta += "_meta_podaci_sql."

        meta += child.meta_podaci[3]

        self.lista_putanja.append(meta)
        self.lista_putanja.remove(self.lista_putanja[self.central_widget.currentIndex()])
Esempio n. 24
0
 def random_tab(self,m):
     queens0 = np.arange(m)
     np.random.shuffle(queens0)
     return Tab(queens0)