Beispiel #1
0
    def __init__(self):
        self.model = gtk.ListStore(object,str,str,str)
        Page.__init__(self)

        self.cfg = PythmConfig()

        self.btn_connect = ImageButton(gtk.STOCK_CONNECT)
        self.btnbox.add(self.btn_connect)
        self.btn_connect.connect("clicked",self.btn_connect_clicked)

        self.btn_start = ImageButton(gtk.STOCK_EXECUTE)
        self.btnbox.add(self.btn_start)
        self.btn_start.connect("clicked",self.btn_start_clicked)

        self.btn_stop = ImageButton(gtk.STOCK_STOP)
        self.btnbox.add(self.btn_stop)
        self.btn_stop.connect("clicked",self.btn_stop_clicked)

        self.btn_refresh = ImageButton(gtk.STOCK_REFRESH)
        self.btnbox.add(self.btn_refresh)
        self.btn_refresh.connect("clicked",self.btn_refresh_clicked)

        self.mgr = BackendManager()

        if self.cfg.get_backend() != None:
            self.start_backend(self.cfg.get_backend())

        self.refresh()
        self.row_selected(None)
        self.set_sensitive(True)
 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     self.lookup = lookup
     if type(lookup) is int:
         self._root_locator = (self._base_locator[0], "%s[%i]" % (self._base_locator[1], lookup))
     elif type(lookup) is unicode:
         self._root_locator = (self._base_locator[0], "%s[h3[normalize-space(text()) = '%s']]" % (self._base_locator[1], lookup))
Beispiel #3
0
    def __init__(self):
        self.duration = 0.0       # Druation of current song.
        self.posBarPressed = False  # Set song position from backend in slider.
        self.posBarDownVal = -1

        Page.__init__(self);
        self.cfg.get_backend().connect(Signals.VOLUME_CHANGED,self.volume_changed)
        self.cfg.get_backend().connect(Signals.RANDOM_CHANGED,self.random_changed)
        self.cfg.get_backend().connect(Signals.REPEAT_CHANGED,self.repeat_changed)
        self.cfg.get_backend().connect(Signals.SONG_CHANGED,self.song_changed)
        self.cfg.get_backend().connect(Signals.POS_CHANGED,self.pos_changed)
        self.cfg.get_backend().connect(Signals.STATE_CHANGED,self.state_changed)

        self.btn_prev = ImageButton(gtk.STOCK_MEDIA_PREVIOUS)
        self.btnbox.add(self.btn_prev)
        self.btn_stop = ImageButton(gtk.STOCK_MEDIA_STOP)
        self.btnbox.add(self.btn_stop)
        self.btn_pause = ImageButton(gtk.STOCK_MEDIA_PAUSE)
        self.btnbox.add(self.btn_pause)
        self.btn_play = ImageButton(gtk.STOCK_MEDIA_PLAY)
        self.btnbox.add(self.btn_play)
        self.btn_next = ImageButton(gtk.STOCK_MEDIA_NEXT)
        self.btnbox.add(self.btn_next)


        self.btn_play.connect("clicked", self.btn_clicked)
        self.btn_stop.connect("clicked", self.btn_clicked)
        self.btn_prev.connect("clicked", self.btn_clicked)
        self.btn_next.connect("clicked", self.btn_clicked)
        self.btn_pause.connect("clicked", self.btn_clicked)

        self.volevent = False
Beispiel #4
0
    def __init__(self, testsetup):
        Page.__init__(self, testsetup)

        handles = self.selenium.window_handles
        for i in handles:
            self.selenium.switch_to_window(i)
            if self.selenium.title == "BrowserID": break
Beispiel #5
0
	def __init__(self, path):
		Page.__init__(self)

		module,name=path.rsplit('.', 1)

		app=__import__(module, fromlist=[ name ])

		self.app=getattr(app, name)()
Beispiel #6
0
    def __init__(self, *args, **kwargs):
        self.master = kwargs['master']
        self.review = kwargs.pop('review')

        self.deck_name = 'default'
        self.page_name = f"{self.deck_name} | Cards left: 2."
        self.card = self.review.next_card()
        Page.__init__(self, *args, **kwargs)
Beispiel #7
0
 def __init__(self):
     Page.__init__(self)
     self._current_line = 0
     self._tail = False
     self._content = ""
     with open("/tmp/clazy.json", 'r') as f:
         self._parse_lines(f.read())
         f.close()
Beispiel #8
0
 def __init__(self):
     Page.__init__(self)
     self._current_line = 0
     self._code = [
         "NumberWrapper* wrap3 = nullptr;",
         "",
         "//Check if the URI is complete or short",
         "const bool hasAtSign = uri.hasHostname();",
         "",
         "// Append the account hostname, this should always reach the same destination",
         "// as long as the server implementation isn't buggy.",
         "const auto extendedUri = (hasAtSign || !account) ? uri : URI(QStringLiteral(\"%1@%2\")",
         "    .arg(uri)",
         "    .arg(account->hostname()));",
         "",
         "//Try to see if there is a better candidate with a suffix (LAN only)",
         "if ( !hasAtSign && account ) {",
         "",
         "    // Attempt an early candidate using the extended URI. The later",
         "    // `confirmedCandidate2` will attempt a similar, but less likely case.",
         "    if ((wrap2 = d_ptr->m_hDirectory.value(extendedUri))) {",
         "        if (auto cm = d_ptr->fillDetails(wrap2, extendedUri, account, contact, type))",
         "        return cm;",
         "    }",
         "}",
         "",
         "//Check",
         "ContactMethod* confirmedCandidate = d_ptr->fillDetails(wrap,uri,account,contact,type);",
         "",
         "//URIs can be represented in multiple way, check if a more verbose version",
         "//already exist",
         "ContactMethod* confirmedCandidate2 = nullptr;",
         "",
         "//Try to use a ContactMethod with a contact when possible, work only after the",
         "//contact are loaded",
         "if (confirmedCandidate && confirmedCandidate->contact())",
         "    confirmedCandidate2 = d_ptr->fillDetails(wrap2,uri,account,contact,type);",
         "",
         "ContactMethod* confirmedCandidate3 = nullptr;",
         "",
         "//Else, try to see if the hostname correspond to the account and flush it",
         "//This have to be done after the parent if as the above give \"better\"",
         "//results. It cannot be merged with wrap2 as this check only work if the",
         "//candidate has an account.",
         "if (hasAtSign && account && uri.hostname() == account->hostname()) {",
         "    if ((wrap3 = d_ptr->m_hDirectory.value(uri.userinfo()))) {",
         "        foreach(ContactMethod* number, wrap3->numbers) {",
         "        if (number->account() == account) {",
         "            if (contact && ((!number->contact()) || (contact->uid() == number->contact()->uid())))",
         "                number->setPerson(contact); //TODO Check all cases from fillDetails()",
         "            //TODO add alternate URI",
         "            confirmedCandidate3 = number;",
         "            break;",
         "        }",
         "        }",
         "    }",
         "}",
     ]
Beispiel #9
0
 def __init__(self):
     Page.__init__(self)
     self._current_line = 0
     self._code = [
         "NumberWrapper* wrap3 = nullptr;",
         "",
         "//Check if the URI is complete or short",
         "const bool hasAtSign = uri.hasHostname();",
         "",
         "// Append the account hostname, this should always reach the same destination",
         "// as long as the server implementation isn't buggy.",
         "const auto extendedUri = (hasAtSign || !account) ? uri : URI(QStringLiteral(\"%1@%2\")",
         "    .arg(uri)",
         "    .arg(account->hostname()));",
         "",
         "//Try to see if there is a better candidate with a suffix (LAN only)",
         "if ( !hasAtSign && account ) {",
         "",
         "    // Attempt an early candidate using the extended URI. The later",
         "    // `confirmedCandidate2` will attempt a similar, but less likely case.",
         "    if ((wrap2 = d_ptr->m_hDirectory.value(extendedUri))) {",
         "        if (auto cm = d_ptr->fillDetails(wrap2, extendedUri, account, contact, type))",
         "        return cm;",
         "    }",
         "}",
         "",
         "//Check",
         "ContactMethod* confirmedCandidate = d_ptr->fillDetails(wrap,uri,account,contact,type);",
         "",
         "//URIs can be represented in multiple way, check if a more verbose version",
         "//already exist",
         "ContactMethod* confirmedCandidate2 = nullptr;",
         "",
         "//Try to use a ContactMethod with a contact when possible, work only after the",
         "//contact are loaded",
         "if (confirmedCandidate && confirmedCandidate->contact())",
         "    confirmedCandidate2 = d_ptr->fillDetails(wrap2,uri,account,contact,type);",
         "",
         "ContactMethod* confirmedCandidate3 = nullptr;",
         "",
         "//Else, try to see if the hostname correspond to the account and flush it",
         "//This have to be done after the parent if as the above give \"better\"",
         "//results. It cannot be merged with wrap2 as this check only work if the",
         "//candidate has an account.",
         "if (hasAtSign && account && uri.hostname() == account->hostname()) {",
         "    if ((wrap3 = d_ptr->m_hDirectory.value(uri.userinfo()))) {",
         "        foreach(ContactMethod* number, wrap3->numbers) {",
         "        if (number->account() == account) {",
         "            if (contact && ((!number->contact()) || (contact->uid() == number->contact()->uid())))",
         "                number->setPerson(contact); //TODO Check all cases from fillDetails()",
         "            //TODO add alternate URI",
         "            confirmedCandidate3 = number;",
         "            break;",
         "        }",
         "        }",
         "    }",
         "}",
     ]
Beispiel #10
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     self.altom_logo = Element(self.driver, (By.XPATH, ".//*[@id='site-title']/a/img"))
     self.sidebar = Element(self.driver, (By.CLASS_NAME, "sidebar"))
     self.main_content = Element(self.driver, (By.ID, "mainContent"))
     self.main_menu = Element(self.driver, (By.ID, "mainMenu"))
     self.video = Element(self.driver, (By.ID, "presentation"))
     self.phone_number = Element(self.driver, (By.CLASS_NAME, "mainPhone"))
     self.blocks = Element(self.driver, (By.CLASS_NAME, "blocks"))
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        window = Toplevel(self)
        window.title("Product window")
        window.state('zoomed')

        all_products = Frame(window)
        all_products.pack(side=LEFT, fill=Y)
        Label(all_products, text="All avaliable products").pack()
        self.allprod_listbox = Listbox(all_products, width=80)
        self.allprod_listbox.bind('<Double-1>',self.all_list_on_click)
        self.prod_list = Product.show_all_the_products().split("\n")
        self.prod_list.pop(-1)
        for prod in self.prod_list:
            self.allprod_listbox.insert(END, prod)
        self.allprod_listbox.pack(side="top", fill="both")
        all_docx = Button(all_products, text="Export info in docx about all products", command=self.form_docx_report())
        all_docx.pack()
        all_exel = Button(all_products, text="Export info in exel about all products", command=self.form_exel_report())
        all_exel.pack()

        search_product = Frame(window)
        search_product.pack(side=LEFT, fill=Y)
        Label(search_product, text="Search product by name").pack()
        enter_name = Entry(search_product)
        enter_name.pack()
        self.find_listbox = Listbox(search_product, width=80)
        self.find_listbox.bind('<Double-1>', self.find_list_on_click)
        find_prod = partial(self.search_prod_on_click, self.find_listbox, enter_name)
        search_btn = Button(search_product, text="Search", command=find_prod)
        search_btn.pack()
        self.find_listbox.pack()

        add_product = Frame(window)
        add_product.pack(side=LEFT, fill=Y)
        Label(add_product, text="Add new product").grid(row=0, column=0, columnspan=3)
        name_label = Label(add_product, text="Enter products` name:")
        unit_label = Label(add_product, text="Enter products` measurment unit:")
        sell_label = Label(add_product, text="Enter products` sell price:")
        purchase_label = Label(add_product, text="Enter products` purchase price:")
        name_entry = Entry(add_product)
        unit_entry = Entry(add_product)
        sell_entry = Entry(add_product)
        purchase_entry = Entry(add_product)
        add_prod = partial(self.add_product, name_entry, unit_entry, sell_entry, purchase_entry,self.allprod_listbox)
        add_btn = Button(add_product, text="Add", command=add_prod)
        name_label.grid(row=1, column=0)
        unit_label.grid(row=2, column=0)
        sell_label.grid(row=3, column=0)
        purchase_label.grid(row=4, column=0)
        name_entry.grid(row=1, column=1)
        unit_entry.grid(row=2, column=1)
        sell_entry.grid(row=3, column=1)
        purchase_entry.grid(row=4, column=1)
        add_btn.grid(row=5, column=1)
Beispiel #12
0
    def __init__(self, testsetup):
        Page.__init__(self, testsetup)

        self.selenium.wait_for_pop_up("", self.timeout)

        handles = self.selenium.get_all_window_titles()

        for i in handles:
            self.selenium.select_window(i)
            if self.selenium.get_title == self._pop_up_title:
                self.selenium.window_focus()
                break
Beispiel #13
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs, bg='mint cream')
        label = tk.Label(self,
                         text='Налаштування',
                         font='Times 20',
                         bg='mint cream')
        label.pack(side='top')

        with open('configs/config.json', encoding='utf-8') as json_file:
            data = json.load(json_file)

        container = tk.Frame(self, bg='azure3', pady=5, padx=10)
        container.pack(side='top', pady=3)

        container1 = tk.Frame(container, bg='azure3', pady=5, padx=10)
        container1.pack(side='top', pady=3)
        var1 = tk.StringVar()
        tk.Label(container1,
                 text='Ім\'я лікаря: ',
                 font='Times 14',
                 bg='azure3').pack(side='left')
        entr = ttk.Entry(container1, textvariable=var1, font='Times 14')
        entr.insert(0, data['doctorName'])
        entr.pack(side='left', padx=5)

        def tmp1():
            data['doctorName'] = var1.get()
            with open('configs/config.json', 'w') as f:
                f.write(json.dumps(data))

        ttk.Button(container1, text='Зберегти', command=tmp1).pack(side='left')

        container2 = tk.Frame(container, bg='azure3', pady=5, padx=10)
        container2.pack(side='top', pady=3)
        var2 = tk.StringVar()
        tk.Label(container2,
                 text='Назва апарату УЗД: ',
                 font='Times 14',
                 bg='azure3').pack(side='left')
        entr2 = ttk.Entry(container2, textvariable=var2, font='Times 14')
        entr2.insert(0, data['deviceName'])
        entr2.pack(side='left', padx=5)

        def tmp2():
            data['deviceName'] = var2.get()
            with open('configs/config.json', 'w') as f:
                f.write(json.dumps(data))

        ttk.Button(container2, text='Зберегти', command=tmp2).pack(side='left')
Beispiel #14
0
    def __init__(self, master=None, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        # Set breadcrumb frame
        self.label = tk.LabelFrame(
            self, text="Store > Cart", padx=10, pady=10)
        self.label.pack(side="top", fill="both", expand=True)

        # configure grid weights (resize)
        self.label.grid_columnconfigure(0, weight=1)
        self.label.grid_columnconfigure(1, weight=1)
        self.label.grid_columnconfigure(2, weight=1)
        self.label.grid_columnconfigure(3, weight=1)
        self.label.grid_columnconfigure(4, weight=1)
        self.label.grid_columnconfigure(5, weight=1)
        self.label.grid_columnconfigure(6, weight=1)
        self.label.grid_columnconfigure(7, weight=1)
        self.label.grid_columnconfigure(8, weight=1)
        self.label.grid_columnconfigure(9, weight=1)
        self.label.grid_columnconfigure(10, weight=1)
        self.label.grid_columnconfigure(11, weight=1)

        # Set nav buttons
        tk.Button(self.label, text='Back to Store', width=15,
                  command=self.hide).grid(row=0, column=0, columnspan=2, sticky="nw")
        cartDisabled = "normal"
        if (len(self.cart) < 1):
            cartDisabled = "disabled"
        tk.Button(self.label, text='Clear Cart', width=15,
                  command=self.clearCart, state=cartDisabled).grid(row=0, column=10, columnspan=2, sticky="ne")

        # Set Main Image
        cwd = os.getcwd()
        imagesPath = Path(cwd, "images")
        imgPath = imagesPath / "bluebox.png"
        img = tk.PhotoImage(file=rf"{imgPath}")
        mainImage = tk.Label(self.label, image=img)
        mainImage.image = img
        mainImage.grid(row=0, column=2, columnspan=8)

        # Show Discount offers
        tk.Label(self.label, text='Orders of more than 50 boxes ship FREE', fg="dark red", font="Helvetica 20 bold").grid(
            row=1, column=2, columnspan=8)
        tk.Label(self.label, text='Apply a 10% discount with a purchase of 150 boxes or more', fg="dark red", font="Helvetica 20 bold").grid(
            row=2, column=2, columnspan=8)

        # setup the cart
        self.setCart()
Beispiel #15
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs, bg='mint cream')
        label = tk.Label(self,
                         text='Знайти пацієнта в базі',
                         font='Times 20',
                         bg='mint cream')
        label.pack(side='top')

        self.db = Database('patients.db')

        self.mainFrame = tk.Frame(self, bg='mint cream')
        self.mainFrame.pack(side='top', fill='y', expand='true', pady=20)

        self.buildLeftBar()
        self.loadList()
        self.printRightBar()
Beispiel #16
0
    def __init__(self):
        #id, artist, title, album, ('>' when playing)
        self.model = gtk.ListStore(object,str,str,str,str)
        Page.__init__(self)
        self.cfg.get_backend().connect(Signals.PL_CHANGED,self.load_list)
        self.cfg.get_backend().connect(Signals.SONG_CHANGED,self.song_changed)

        self.btn_up = ImageButton(gtk.STOCK_GO_UP)
        self.btnbox.add(self.btn_up)
        self.btn_down = ImageButton(gtk.STOCK_GO_DOWN)
        self.btnbox.add(self.btn_down)
        self.btn_play = ImageButton(gtk.STOCK_MEDIA_PLAY)
        self.btnbox.add(self.btn_play)
        #self.btn_del = ImageButton(gtk.STOCK_REMOVE)
        #self.btnbox.add(self.btn_del)
        self.btn_clear = ImageButton(gtk.STOCK_CLEAR)
        self.btnbox.add(self.btn_clear)
        self.btn_up.connect("clicked",self.clicked_up)
        self.btn_down.connect("clicked",self.clicked_down)
        self.btn_play.connect("clicked",self.clicked_play)
        #self.btn_del.connect("clicked",self.clicked_del)
        self.btn_clear.connect("clicked",self.clicked_clear)
    def __init__(self, master=None, *args, **kwargs):
        # configure page
        Page.__init__(self, *args, **kwargs)
        self.cart = ViewCartPage()

        # Set breadcrumb frame
        self.label = tk.LabelFrame(
            self, text="Store > Item", padx=10, pady=10)
        self.label.pack(side="top", fill="both", expand=True)

        # configure grid weights (resize)
        self.label.grid_columnconfigure(0, weight=1)
        self.label.grid_columnconfigure(1, weight=1)
        self.label.grid_columnconfigure(2, weight=1)
        self.label.grid_columnconfigure(3, weight=1)
        self.label.grid_columnconfigure(4, weight=1)
        self.label.grid_columnconfigure(5, weight=1)
        self.label.grid_columnconfigure(6, weight=1)
        self.label.grid_columnconfigure(7, weight=1)
        self.label.grid_columnconfigure(8, weight=1)
        self.label.grid_columnconfigure(9, weight=1)
        self.label.grid_columnconfigure(10, weight=1)
        self.label.grid_columnconfigure(11, weight=1)

        # Set nav buttons
        tk.Button(self.label, text='Back to Store', width=15,
                  command=self.hide).grid(row=0, column=0, columnspan=2, sticky="nw")
        tk.Button(self.label, text='Cart', width=15,
                  command=self.ViewCartPageNav).grid(row=0, column=10, columnspan=2, sticky="ne")

        # Set Main Image
        cwd = os.getcwd()
        imagesPath = Path(cwd, "images")
        imgPath = imagesPath / "bluebox.png"
        img = tk.PhotoImage(file=rf"{imgPath}")
        mainImage = tk.Label(self.label, image=img)
        mainImage.image = img
        mainImage.grid(row=0, column=2, columnspan=8)
Beispiel #18
0
    def __init__(self):
        self.model = gtk.ListStore(object, str)
        Page.__init__(self)

        self.btn_up = ImageButton(gtk.STOCK_GO_UP)
        self.btnbox.add(self.btn_up)
        self.btn_up.connect("clicked", self.btn_up_clicked)

        self.btn_open = ImageButton(gtk.STOCK_OPEN)
        self.btnbox.add(self.btn_open)
        self.btn_open.connect("clicked", self.btn_open_clicked)

        self.btn_play = ImageButton(gtk.STOCK_MEDIA_PLAY)
        self.btnbox.add(self.btn_play)
        self.btn_play.connect("clicked", self.btn_play_clicked)
        self.path = None

        self.btn_adddir = ImageButton(gtk.STOCK_ADD)
        self.btnbox.add(self.btn_adddir)
        self.btn_adddir.connect("clicked", self.btn_adddir_clicked)
        self.path = None

        self.cfg.get_backend().connect(Signals.BROWSER_CHANGED, self.browser_changed)
Beispiel #19
0
 def __init__(self,
              url=None,
              title='',
              favicon='/page/static/image/favicon.ico',
              static='static',
              cache=True,
              theme=None):
     Page.__init__(self, url, title, favicon, static, cache)
     
     class DefaultTheme(BootPageTheme):
         def __init__(self):
             with open(pwd() + '/theme/default.html') as fd: self.template = jinja2.Template(fd.read())
         def __import__(self, bootpage):
             bootpage.css('/page/bootpage/static/css/theme-default.css')
         def __render__(self, bootpage):
             bootpage.header(
                 self.template.render({
                     'url' : bootpage.url, 'title' : bootpage._page_title, 'menu_list' : bootpage._bp_menu
                 })
             )
     
     if theme != None: self._bp_theme = theme
     else: self._bp_theme = DefaultTheme()
     
     self.css(
         '/page/bootpage/static/css/bootstrap.min.css',
         '/page/bootpage/static/css/bootpage.css',
     )
     self.js(
         '/page/bootpage/static/js/popper.min.js',
         '/page/bootpage/static/js/bootstrap.min.js',
         '/page/bootpage/static/js/bootpage.js',
     )
     self._bp_theme.__import__(self)
     self._bp_menu = []
     self._bp_category = {}
Beispiel #20
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        # Define class-attributes
        self.button_def = []
        self.expr = ""
        self.equation = StringVar()
        self.equation.set('enter your expression')

        # Get button definition array
        get_button_def(self)

        # Create and set expression field
        exp_field = Entry(self, textvariable=self.equation)
        exp_field.grid(columnspan=4, ipadx=70)

        # Create and set calculator buttons
        for row_id, button_row in enumerate(self.button_def):

            for cell_id, button_cell in enumerate(button_row):
                button_entry = self.button_def[row_id][cell_id]

                button = Button(self,
                                text=button_entry['label'],
                                fg='white',
                                bg='blue',
                                command=button_entry['command'],
                                height=1,
                                width=7)

                button.grid(
                    row=row_id + 1,
                    column=button_entry['column'],
                    columnspan=button_entry['columnspan'],
                    sticky=N + S + E + W,
                )
Beispiel #21
0
 def __init__(self):
     Page.__init__(self)
     self._Icons = {}
     self._CanvasHWND = None
     self._MyList = []
Beispiel #22
0
 def __init__(self, testsetup, banner):
     Page.__init__(self, testsetup)
     self._root_element = banner
 def __init__(self, testsetup):
     Page.__init__(self, testsetup)
     self.sel = self.selenium
 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     self.lookup = lookup
Beispiel #25
0
 def __init__(self, testsetup, open_url=True):
     ''' Creates a new instance of the class and gets the page ready for testing '''
     Page.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
Beispiel #26
0
 def __init__(self, elems):
     Page.__init__(self)
     self.elem_list = elems
     self.selected = 5
 def __init__(self, testsetup):
     Page.__init__(self, testsetup)
 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     self.lookup = lookup - 1
     self._root_element = self.selenium.find_elements(*self._tab_selector)[self.lookup]
Beispiel #29
0
 def __init__(self, browser, load=False):
     self._config = ConfigReader(self.__class__.__name__)
     url = self._config.get_page_locator("Url", "url") + self._config.get_locator("url")
     Page.__init__(self, browser, url, load)
Beispiel #30
0
 def __init__(self, testsetup):
     Page.__init__(self, testsetup)
     self.sel = self.selenium
     self.sel.open("/")
Beispiel #31
0
	def __init__(self, *args, **kwargs):
		self.page_name = 'All cards'
		self.master = kwargs['master']
		Page.__init__(self, *args, **kwargs)
Beispiel #32
0
 def __init__(self, flashcard, *args, **kwargs):
     self.page_name = 'Edit flashcard'
     self.flashcard = flashcard
     Page.__init__(self, *args, **kwargs)
 def __init__(self, testsetup, lang):
     Page.__init__(self, testsetup)
     self._root_element = lang
Beispiel #34
0
 def __init__(self, testsetup, element):
     Page.__init__(self, testsetup)
     self._root_element = element
Beispiel #35
0
 def __init__(self):
     Page.__init__(self)
Beispiel #36
0
    def __init__(self):
        Page.__init__(self)
        self.type = "article"
        self.title = None

        # stores the lovely, pure text from the article,
        # stripped of html, formatting, etc...
        # just raw text with paragraphs separated by newlines.
        # This is probably what you want to use.
        self.cleaned_text = u""

        # meta description field in HTML source
        self.meta_description = u""

        # meta lang field in HTML source
        self.meta_lang = u""

        # meta favicon field in HTML source
        self.meta_favicon = u""

        # meta keywords field in the HTML source
        self.meta_keywords = u""

        # The canonical link of this article if found in the meta data
        self.canonical_link = u""

        # holds the domain of this article we're parsing
        self.domain = u""

        # holds the top Element we think
        # is a candidate for the main body of the article
        self.top_node = None

        # holds a set of tags that may have
        # been in the artcle, these are not meta keywords
        self.tags = set()
        # stores the final URL that we're going to try
        # and fetch content against, this would be expanded if any
        self.final_url = u""
        # stores the MD5 hash of the url
        # to use for various identification tasks
        self.link_hash = ""
        # stores the RAW HTML
        # straight from the network connection
        #Already in page
        #self.raw_html = u""
        
        # the lxml Document object
        self.doc = None
        # this is the original JSoup document that contains
        # a pure object from the original HTML without any cleaning
        # options done on it
        self.raw_doc = None
        # Sometimes useful to try and know when
        # the publish date of an article was
        self.publish_date = None

        # A property bucket for consumers of goose to store custom data extractions.
        self.additional_data = {}
        self.links = None
        self.outlinks = None
        self.backlinks = None
        self.start_date = today()
        
        # parser
        self.parser = get_parser()
        
        # init the extractor
        self.extractor = self.get_extractor()

        # init the document cleaner
        self.cleaner = self.get_cleaner()

        # init the output formatter
        self.formatter = self.get_formatter()
Beispiel #37
0
 def __init__(self, *args, **kwargs):
     self.page_name = 'My AnkiDroid'
     self.master = kwargs['master']
     Page.__init__(self, *args, **kwargs)
Beispiel #38
0
 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     if type(lookup) is int:
         self._root_locator = (self._base_locator[0], "%s[%i]" % (self._base_locator[1], lookup))
     elif type(lookup) is unicode:
         self._root_locator = (self._base_locator[0], "%s[descendant::h3/a[text()='%s']]" % (self._base_locator[1], lookup))
Beispiel #39
0
 def __init__(self):
     Page.__init__(self)
     self._lines = [""]
     self._cursor_y = 0
     self._cursor_x = 0
     self._textbox = None
 def __init__(self, name, content, parent="Home"):
     Page.__init__(name, content, parent)
Beispiel #41
0
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        self.equation_text = 'Choose two different cities'
        self.distance_equation = StringVar()
        self.distance_equation.set(self.equation_text)

        # Setup field-rows grid
        self.grid_rowconfigure(0)
        self.grid_rowconfigure(1)
        self.grid_rowconfigure(2)
        self.grid_rowconfigure(3)
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)

        # Read CSV file and create matrix
        path = os.path.abspath(os.path.dirname(__file__))
        file_path = os.path.join(path, "distances.csv")
        file = open(file_path, 'rt', encoding='utf8')
        data_list = list(csv.reader(file))
        options = data_list[0]

        # Define callbacks
        current = self

        def combo_cb_one(_: Combobox) -> None:
            combo_select_cb(current, combo_one, combo_two, options, data_list)

        def combo_cb_two(_: Combobox) -> None:
            combo_select_cb(current, combo_one, combo_two, options, data_list)

        def reset_cb() -> None:
            reset_distance(current, combo_one, combo_two)

        # Create labels
        label_one = Label(self, text='City #1')
        label_two = Label(self, text='City #2')
        label_three = Label(self, text='Distance')

        # Create combobox-fields
        combo_one = Combobox(self, values=options, state="readonly")
        combo_two = Combobox(self, values=options, state="readonly")

        # Apply default values on combobox-fields
        combo_one.current(0)
        combo_two.current(0)

        # Bind select callbacks on combobox-fields
        combo_one.bind("<<ComboboxSelected>>", combo_cb_one)
        combo_two.bind("<<ComboboxSelected>>", combo_cb_two)

        # Create result-field and configure
        expr_field = Label(self, textvariable=self.distance_equation)
        # expr_field.configure(state='readonly')

        # Create reset button
        reset_button = Button(self, text='Reset', command=reset_cb, width=7)

        # Apply labels to frame-grid
        label_one.grid(row=0, column=0, sticky=N + W)
        label_two.grid(row=1, column=0, sticky=N + W)
        label_three.grid(row=2, column=0, sticky=N + W)

        # Apply combo-boxes to frame-grid
        combo_one.grid(row=0, column=1, columnspan=5, sticky=N + S + E + W)
        combo_two.grid(row=1, column=1, columnspan=5, sticky=N + S + E + W)

        # Apply expression-field to frame-grid
        expr_field.grid(row=2, column=1, columnspan=5, sticky=N + W)

        # Apply reset-button to frame-grid
        reset_button.grid(row=3,
                          column=0,
                          columnspan=6,
                          ipadx=70,
                          sticky=N + S + E + W)
Beispiel #42
0
 def __init__(self, driver):
     Page.__init__(self, driver)
     Page.navigate(self, Settings.url)
Beispiel #43
0
 def __init__(self):
     Page.__init__(self)
     self.expand = True
     self.tabs = []  #["Simple", "Complex", "Extreme"]
     self.selected = 0
Beispiel #44
0
 def __init__(self):
     Page.__init__(self)
     self.full_width = True
     self._entry = None
Beispiel #45
0
 def __init__(self):
     Page.__init__(self)
     self.height = 8
     self._entry = None
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        window = Toplevel(self)
        window.title("Sales window")
        window.state('zoomed')

        all_sales = Frame(window)
        all_sales.pack(side=LEFT, fill=Y)
        Label(all_sales,
              text="All avaliable sellers(double click to delete)").pack()
        self.allsales_listbox = Listbox(all_sales, width=80)
        self.allsales_listbox.bind('<Double-1>', self.all_list_on_click)
        self.sales_list = Sales.show_all_sales().split("\n")
        self.sales_list.pop(-1)
        for sale in self.sales_list:
            self.allsales_listbox.insert(END, sale)
        self.allsales_listbox.pack(side="top", fill="both")
        all_docx = Button(all_sales,
                          text="Export info in docx about all sales",
                          command=self.form_docx_report())
        all_docx.pack()
        all_exel = Button(all_sales,
                          text="Export info in exel about all sales",
                          command=self.form_exel_report())
        all_exel.pack()

        search_sale = Frame(window)
        search_sale.pack(side=LEFT, fill=Y)
        Label(search_sale, text="Search sale by date").pack()
        date_entry = Entry(search_sale)
        date_entry.pack()
        self.find_listbox = Listbox(search_sale, width=80)
        self.find_listbox.bind('<Double-1>', self.find_list_on_click)
        find_sale = partial(self.search_sale_on_click, self.find_listbox,
                            date_entry)
        search_btn = Button(search_sale, text="Search", command=find_sale)
        search_btn.pack()
        self.find_listbox.pack()

        add_sale = Frame(window)
        add_sale.pack(side=LEFT, fill=Y)
        Label(add_sale, text="Add new sale").grid(row=0,
                                                  column=0,
                                                  columnspan=3)
        seller_id = Label(add_sale, text="Enter sellers` id:")
        prod_label = Label(add_sale, text="Enter products splited by coma:")
        amount_label = Label(add_sale,
                             text="Enter amounts of each product by coma:")
        id_entry = Entry(add_sale)
        prod_entry = Entry(add_sale)
        amount_entry = Entry(add_sale)
        new_sale_add = partial(self.add_sale, id_entry, prod_entry,
                               amount_entry, self.allsales_listbox)
        add_btn = Button(add_sale, text="Add", command=new_sale_add)
        seller_id.grid(row=1, column=0)
        prod_label.grid(row=2, column=0)
        amount_label.grid(row=3, column=0)
        id_entry.grid(row=1, column=1)
        prod_entry.grid(row=2, column=1)
        amount_entry.grid(row=3, column=1)
        add_btn.grid(row=5, column=1)
 def __init__(self, testsetup, lang):
     Page.__init__(self, testsetup)
     self._root_element = lang
 def __init__(self, testsetup, lookup):
     Page.__init__(self, testsetup)
     self._root_element = self.selenium.find_element(By.CSS_SELECTOR,
                                   "%s:nth-child(%s)" % (self._home_news_locator[1], lookup))
 def __init__(self, testsetup, open_url=True):
     ''' Creates a new instance of the class and gets the page ready for testing '''
     Page.__init__(self, testsetup)
     if open_url:
         self.selenium.get(self.base_url)
Beispiel #50
0
 def __init__(self, name, content, parent="Home"):
     Page.__init__(name, content, parent)
 def __init__(self, testsetup):
     Page.__init__(self, testsetup)
     self.sel = self.selenium
     self.sel.open("/")
Beispiel #52
0
 def __init__(self, browser, load=False):
     self._config = ConfigReader(self.__class__.__name__)
     url = self._config.get_page_locator('Url', 'url') + \
             self._config.get_locator('url')
     Page.__init__(self, browser, url, load)
Beispiel #53
0
 def __init__(self):
     Page.__init__(self)
     self.full_width = True
     self._entry = None
Beispiel #54
0
 def __init__(self, testsetup, index):
     Page.__init__(self, testsetup)
     self.index = index
Beispiel #55
0
 def __init__(self, testsetup, element):
     Page.__init__(self, testsetup)
     self._root_element = element
Beispiel #56
0
 def __init__(self):
     Page.__init__(self)
     self.height = 2
Beispiel #57
0
 def __init__(self, *args, **kwargs):
     Page.__init__(self, *args, **kwargs)
     label = tk.Label(self, text="This is page 3")
     label.pack(side="top", fill="both", expand=True)
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        window = Toplevel(self)
        window.title("Seller window")
        window.state('zoomed')

        all_sellers = Frame(window)
        all_sellers.pack(side=LEFT, fill=Y)
        Label(all_sellers, text="All avaliable sellers").pack()
        self.allseller_listbox = Listbox(all_sellers, width=80)
        self.allseller_listbox.bind('<Double-1>', self.all_list_on_click)
        self.seller_list = Seller.show_all_sellers().split("\n")
        self.seller_list.pop(-1)
        for seller in self.seller_list:
            self.allseller_listbox.insert(END, seller)
        self.allseller_listbox.pack(side="top", fill="both")
        all_docx = Button(all_sellers,
                          text="Export info in docx about all sellers",
                          command=self.form_docx_report())
        all_docx.pack()
        all_exel = Button(all_sellers,
                          text="Export info in exel about all sellers",
                          command=self.form_exel_report())
        all_exel.pack()

        search_seller = Frame(window)
        search_seller.pack(side=LEFT, fill=Y)
        Label(search_seller, text="Search seller by surname").pack()
        enter_name = Entry(search_seller)
        enter_name.pack()
        self.find_listbox = Listbox(search_seller, width=80)
        self.find_listbox.bind('<Double-1>', self.find_list_on_click)
        find_prod = partial(self.search_seller_on_click, self.find_listbox,
                            enter_name)
        search_btn = Button(search_seller, text="Search", command=find_prod)
        search_btn.pack()
        self.find_listbox.pack()

        add_seller = Frame(window)
        add_seller.pack(side=LEFT, fill=Y)
        Label(add_seller, text="Add new seller").grid(row=0,
                                                      column=0,
                                                      columnspan=3)
        name_label = Label(add_seller, text="Enter sellers` name:")
        surname_label = Label(add_seller, text="Enter sellers` surname:")
        middle_name_label = Label(add_seller,
                                  text="Enter sellers middle name:")
        income_percent_label = Label(add_seller,
                                     text="Enter sellers` income price:")
        name_entry = Entry(add_seller)
        surname_entry = Entry(add_seller)
        middle_name_entry = Entry(add_seller)
        income_percent_entry = Entry(add_seller)
        add_sel = partial(self.add_seller, name_entry, surname_entry,
                          middle_name_entry, income_percent_entry,
                          self.allseller_listbox)
        add_btn = Button(add_seller, text="Add", command=add_sel)
        name_label.grid(row=1, column=0)
        surname_label.grid(row=2, column=0)
        middle_name_label.grid(row=3, column=0)
        income_percent_label.grid(row=4, column=0)
        name_entry.grid(row=1, column=1)
        surname_entry.grid(row=2, column=1)
        middle_name_entry.grid(row=3, column=1)
        income_percent_entry.grid(row=4, column=1)
        add_btn.grid(row=5, column=1)