How to use _is_visible method in robotframework-appiumlibrary

Best Python code snippet using robotframework-appiumlibrary_python

inherited_res_partner.py

Source:inherited_res_partner.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from odoo import models, fields, api, _3from . import tools_hubi4class HubiInheritedResPartner(models.Model):5 _inherit = "res.partner"6 7 def _is_Visible(self):8 return tools_hubi._is_Visible_class(self, 'Partner')9 def _default_is_Visible(self, valeur):10 return tools_hubi._default_is_Visible_class(self, valeur) 11 12 def _default_family(self, valeur): 13 retour = 014 option=self.env['hubi.family']15 check_opt=option.search([('level','=', valeur)])16 for check in check_opt:17 if check.default_value:18 retour = check.id19 return retour20 21 def _get_default_company_id(self):22 return self._context.get('force_company', self.env.user.company_id.id)23 24 country_id = fields.Many2one('res.country', string='Country', ondelete='restrict', default=lambda self: self.env['res.country'].search([('code','=','FR')]))25 family_type_id = fields.Many2one('hubi.family', string='Type', domain=[('level', '=', 'Type')], help="The type of the partner.", default=lambda self: self._default_family('Type'))26 family_job_id = fields.Many2one('hubi.family', string='Job', domain=[('level', '=', 'Job')], help="The job of the partner.", default=lambda self: self._default_family('Job'))27 family_id = fields.Many2one('hubi.family', string='Family', domain=[('level', '=', 'Family')], help="The family of the partner.", default=lambda self: self._default_family('Family'))28 cee_code = fields.Char(string='CEE Code')29 remote_operation = fields.Boolean(string='Remote operation', default=False)30 sender_establishment = fields.Many2one('res.partner', string='Sender establishment', default=_get_default_company_id)31 excluded_packaging = fields.Boolean(string='Excluded packaging', default=False)32 shipping = fields.Boolean(string='Shipping', default=False)33 billing_fees = fields.Boolean(string='Billing fees', default=False)34 frs_code = fields.Char(string='FRS Code')35 ifls_code = fields.Char(string='IFLS Code')36 ifls_edit_invoice = fields.Boolean(string='IFLS Edit Invoice', default=False)37 ifls_edit_delivery = fields.Boolean(string='IFLS Edit Delivery', default=False)38 ifls_edit_etiq = fields.Boolean(string='IFLS Edit Etiq', default=False)39 discount_invoice = fields.Float(string='Discount Invoice')40 discount_ca = fields.Float(string='Discount CA')41 discount_period_ca = fields.Selection([("Monthly", "Monthly"), ("Quarterly", "Quarterly"),42 ("Annual", "Annual")], string="Period Discount CA")43 discount_description = fields.Char(string='CA Discount Description')44 deb = fields.Boolean(string='DEB', default=False)45 product_grouping = fields.Boolean(string='Product grouping', default=False)46 invoice_grouping = fields.Boolean(string='Invoice grouping', default=False)47 number_invoice = fields.Integer(string = 'Number Invoice', default=1)48 number_delivery = fields.Integer(string = 'Number Delivery', default=1)49 bottom_message_invoice = fields.Text(string='Bottom message invoice')50 bottom_message_delivery = fields.Text(string='Bottom message delivery')51 edit_price_kg = fields.Boolean(string='Edit price kg', default=False)52 valued_delivery = fields.Boolean(string='Valued delivery', default=False)53 amount_com_kg = fields.Float(string='Amount commission kg') 54 periodicity_invoice = fields.Selection([("Daily", "Daily"),("Weekly", "Weekly"),("Decade", "Decade"),55 ("Fortnight", "Fortnight"),("Monthly", "Monthly")], string="Invoice Period")56 edit_weight = fields.Boolean(string='Edit weight', default=False)57 auxiliary_account_customer = fields.Char(string='Auxiliary Account Customer')58 auxiliary_account_supplier = fields.Char(string='Auxiliary Account Supplier')59 carrier_id = fields.Many2one('delivery.carrier',string = 'Carrier')60 price_list_id = fields.Integer(string = 'Price List')61 edi_invoice = fields.Boolean(string='EDI Invoice', default=False)62 edi_invoice_prod = fields.Boolean(string='EDI Invoice Production', default=False)63 edi_transport_recipient = fields.Char(string='EDI Transport Recipient')64 order_code_ean = fields.Char(string='Order Code_EAN')65 order_name = fields.Char(string='Order Name')66 code_ean = fields.Char(string='EAN Code')67 customer_color_etiq = fields.Selection([("#FF00FF", "magenta"),("#0000FF", "blue"),68 ("#FFFF00", "yellow"),("#FF0000", "red"),69 ("#008000", "green"),("#D2691E", "brown"),70 ("#FFFFFF", "white"),("#CCCCCC", "grey"),71 ("#FFC0CB", "pink")], string='Customer Color Etiq') 72 customer_name_etiq = fields.Char(string='Customer Name Etiq')73 customer_city_etiq = fields.Char(string='Customer City Etiq')74 automatic_batch = fields.Boolean(string='Automatic Batch', default=False)75 ean128 = fields.Boolean(string='EAN128', default=False)76 code_ean128 = fields.Char(string='Start of barcode 128')77 compteur_ean128 = fields.Integer(string='Barcode 128 counter', default=0)78 dlc = fields.Boolean(string='DLC', default=False)79 dlc_number_day = fields.Integer(string = 'DLC Number Day')80 type_etiq = fields.Selection([("1", "Etiquette Type 1"),("2", "Etiquette Type 2"),81 ("3", "Etiquette Type 3")], string="Type Etiq")82 asset = fields.Char(string='Asset')83 siret = fields.Char(string='Siret')84 rcs = fields.Char(string='RCS')85 naf = fields.Char(string='NAF')86 health_number = fields.Char(string='Health Number')87 red_label_number = fields.Char(string='Red Label Number')88 cnuf = fields.Char(string='CNUF')89 company_name_etiq = fields.Char(string='Customer Name Etiq')90 company_city_etiq = fields.Char(string='Customer City Etiq')91 label_model_id = fields.Many2one('hubi.labelmodel', string='Label model')92 etiq_printer = fields.Many2one('hubi.printer', string='Label Printer', domain=[('isimpetiq', '=', True)])93 etiq_mention = fields.Char(string='Etiq Mention')94 95 statistics_alpha_1 = fields.Char(string='statistics alpha 1')96 statistics_alpha_2 = fields.Char(string='statistics alpha 2')97 statistics_alpha_3 = fields.Char(string='statistics alpha 3')98 statistics_alpha_4 = fields.Char(string='statistics alpha 4')99 statistics_alpha_5 = fields.Char(string='statistics alpha 5')100 statistics_num_1 = fields.Float(string='statistics numerical 1')101 statistics_num_2 = fields.Float(string='statistics numerical 2')102 statistics_num_3 = fields.Float(string='statistics numerical 3')103 statistics_num_4 = fields.Float(string='statistics numerical 4')104 statistics_num_5 = fields.Float(string='statistics numerical 5')105 106 over_credit = fields.Boolean('Allow Over Credit?', default=True)107 108 is_frs=fields.Boolean(string='is_FRS', compute='_is_Visible', default=lambda self: self._default_is_Visible('REF_FRS'))109 is_ifls=fields.Boolean(string='is_IFLS', compute='_is_Visible', default=lambda self: self._default_is_Visible('GESTION_IFLS'))110 is_edi_facture=fields.Boolean(string='is_EDI_FACTURE', compute='_is_Visible', default=lambda self: self._default_is_Visible('EDI_FACTURE'))111 is_edi_transporteur=fields.Boolean(string='is_EDI_TRANSPORTEUR', compute='_is_Visible', default=lambda self: self._default_is_Visible('EDI_TRANSPORTEUR'))112 is_bl_valorise=fields.Boolean(string='is_BL_VALORISE', compute='_is_Visible', default=lambda self: self._default_is_Visible('BL_VALORISE'))113 is_etiq_lot_auto=fields.Boolean(string='is_ETIQ_LOT_AUTO', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_LOT_AUTO'))114 is_prix_kg=fields.Boolean(string='is_PRIX_KG', compute='_is_Visible', default=lambda self: self._default_is_Visible('PRIX_KG'))115 is_type_tiers=fields.Boolean(string='is_TYPE_TIERS', compute='_is_Visible', default=lambda self: self._default_is_Visible('TYPE_TIERS'))116 is_etiq_dlc=fields.Boolean(string='is_ETIQ_DLC', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_DLC'))117 is_etiq_couleur_client=fields.Boolean(string='is_ETIQ_COULEUR_CLIENT', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_COULEUR_CLIENT'))118 is_etiq_ean_128=fields.Boolean(string='is_ETIQ_EAN_128', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_EAN_128'))119 is_etiq_mode=fields.Boolean(string='is_ETIQ_MODE', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_MODE'))120 is_etiq_type=fields.Boolean(string='is_ETIQ_TYPE', compute='_is_Visible', default=lambda self: self._default_is_Visible('ETIQ_TYPE'))121 is_export_compta=fields.Boolean(string='is_EXPORT_COMPTA', compute='_is_Visible', default=lambda self: self._default_is_Visible('EXPORT_COMPTA'))122 is_fonction_deporte=fields.Boolean(string='is_FONCTION_DEPORTE', compute='_is_Visible', default=lambda self: self._default_is_Visible('FONCTION_DEPORTE'))123 is_regr_prod_fac=fields.Boolean(string='is_REGR_PROD_FAC', compute='_is_Visible', default=lambda self: self._default_is_Visible('REGR_PROD_FAC'))124 125 @api.onchange('name')126 def _onchange_auxiliary(self):127 128 val_company_id = self.company_id.id 129 val_name = 'General Settings'130 name_partner = ""131 if self.name:132 name_partner = self.name.replace('\\','') \133 .replace('"','') \134 .replace('\n', '') \135 .replace(' ', '') \136 .replace('-', '') \137 .replace('_', '') \138 .replace("'", '') \139 .replace('.', '') \140 .replace('ê', 'e') \141 .replace('è', 'e') \142 .replace('é', 'e') \143 .replace('à', 'a') \144 .replace('ô', 'o') \145 .replace('ö', 'o') \146 .replace('î', 'i') 147 148 149 settings = self.env['hubi.general_settings'].search([('name','=', val_name), ('company_id','=', val_company_id)])150 if settings:151 root_customer = settings.root_account_auxiliary_customer152 root_supplier = settings.root_account_auxiliary_supplier153 length_auxiliary = settings.length_account_auxiliary or 0154 complete_0_auxiliary = settings.complete_0_account_auxiliary or False155 156 if (root_customer and not self.auxiliary_account_customer ):157 account_customer = root_customer + name_partner158 if length_auxiliary != 0:159 if (complete_0_auxiliary):160 account_customer = account_customer.ljust(length_auxiliary,'0')161 else: 162 account_customer = account_customer[0:length_auxiliary]163 164 self.auxiliary_account_customer = account_customer165 if (root_customer and not self.auxiliary_account_supplier ):166 account_supplier = root_supplier + name_partner167 if length_auxiliary != 0:168 if (complete_0_auxiliary):169 account_supplier = account_supplier.ljust(length_auxiliary,'0')170 else: 171 account_supplier = account_supplier[0:length_auxiliary]172 ...

Full Screen

Full Screen

XLST___kitao___pyxel_widget.py

Source:XLST___kitao___pyxel_widget.py Github

copy

Full Screen

1import pyxel2from .constants import (3 WIDGET_CLICK_DIST,4 WIDGET_CLICK_TIME,5 WIDGET_HOLD_TIME,6 WIDGET_PANEL_COLOR,7 WIDGET_REPEAT_TIME,8 WIDGET_SHADOW_COLOR,9)10class Widget:11 """12 Events:13 __on_show()14 __on_hide()15 __on_enabled()16 __on_disabled()17 __on_move(x, y)18 __on_resize(width, height)19 __on_mouse_down(key, x, y)20 __on_mouse_up(key, x, y)21 __on_mouse_drag(key, x, y, dx, dy)22 __on_mouse_repeat(key, x, y)23 __on_mouse_click(key, x, y)24 __on_mouse_hover(x, y)25 __on_update()26 __on_draw()27 """28 class CaptureInfo:29 widget = None30 key = None31 time = None32 press_pos = None33 last_pos = None34 _capture_info = CaptureInfo()35 def __init__(36 self, parent, x, y, width, height, *, is_visible=True, is_enabled=True37 ):38 self._parent = None39 self._children = []40 self._x = None41 self._y = None42 self._width = None43 self._height = None44 self._is_visible = None45 self._is_enabled = None46 self._event_handler_lists = {}47 self.parent = parent48 self.move(x, y)49 self.resize(width, height)50 self.is_visible = is_visible51 self.is_enabled = is_enabled52 @property53 def parent(self):54 return self._parent55 @parent.setter56 def parent(self, value):57 if self._parent:58 self._parent._children.remove(self)59 self._parent = value60 if value:61 value._children.append(self)62 @property63 def x(self):64 return self._x65 @property66 def y(self):67 return self._y68 @property69 def width(self):70 return self._width71 @property72 def height(self):73 return self._height74 @property75 def is_visible(self):76 return self._is_visible77 @is_visible.setter78 def is_visible(self, value):79 if self._is_visible == value:80 return81 self._is_visible = value82 if value:83 self.call_event_handler("show")84 else:85 self.call_event_handler("hide")86 @property87 def is_enabled(self):88 return self._is_enabled89 @is_enabled.setter90 def is_enabled(self, value):91 if self._is_enabled == value:92 return93 self._is_enabled = value94 if value:95 self.call_event_handler("enabled")96 else:97 self.call_event_handler("disabled")98 def _get_event_handler_list(self, event):99 if event not in self._event_handler_lists:100 self._event_handler_lists[event] = []101 return self._event_handler_lists[event]102 def add_event_handler(self, event, handler):103 self._get_event_handler_list(event).append(handler)104 def remove_event_handler(self, event, handler):105 self._get_event_handler_list(event).remove(handler)106 def call_event_handler(self, event, *args):107 for handler in self._get_event_handler_list(event):108 handler(*args)109 def is_hit(self, x, y):110 return (111 self._x <= x <= self._x + self._width - 1112 and self._y <= y <= self._y + self._height - 1113 )114 def move(self, x, y):115 if self._x == x and self._y == y:116 return117 if self._x is None or self._y is None:118 self._x = x119 self._y = y120 dx = x - self._x121 dy = y - self._y122 self._move_delta(dx, dy)123 def _move_delta(self, dx, dy):124 self._x += dx125 self._y += dy126 self.call_event_handler("move", self._x, self._y)127 for child in self._children:128 child._move_delta(dx, dy)129 def resize(self, width, height):130 if self._width == width and self._height == height:131 return132 self._width = width133 self._height = height134 self.call_event_handler("resize", width, height)135 @staticmethod136 def draw_panel(x, y, width, height, *, with_shadow=True):137 x = x138 y = y139 w = width140 h = height141 pyxel.line(x + 1, y, x + w - 2, y, WIDGET_PANEL_COLOR)142 pyxel.rect(x, y + 1, w, h - 2, WIDGET_PANEL_COLOR)143 pyxel.line(x + 1, y + h - 1, x + w - 2, y + h - 1, WIDGET_PANEL_COLOR)144 if with_shadow:145 pyxel.line(x + 2, y + h, x + w - 1, y + h, WIDGET_SHADOW_COLOR)146 pyxel.line(x + w, y + 2, x + w, y + h - 1, WIDGET_SHADOW_COLOR)147 pyxel.pix(x + w - 1, y + h - 1, WIDGET_SHADOW_COLOR)148 def _capture_mouse(self, key):149 Widget._capture_info.widget = self150 Widget._capture_info.key = key151 Widget._capture_info.time = pyxel.frame_count152 Widget._capture_info.press_pos = (pyxel.mouse_x, pyxel.mouse_y)153 Widget._capture_info.last_pos = Widget._capture_info.press_pos154 @staticmethod155 def _release_mouse():156 Widget._capture_info.widget = None157 Widget._capture_info.key = None158 Widget._capture_info.time = None159 Widget._capture_info.press_pos = None160 Widget._capture_info.last_pos = None161 def update_widgets(self):162 capture_widget = Widget._capture_info.widget163 if capture_widget:164 capture_widget._process_capture()165 else:166 self._process_input()167 self._update()168 def _process_capture(self):169 capture_info = Widget._capture_info170 last_mx, last_my = capture_info.last_pos171 mx = pyxel.mouse_x172 my = pyxel.mouse_y173 if mx != last_mx or my != last_my:174 self.call_event_handler(175 "mouse_drag", capture_info.key, mx, my, mx - last_mx, my - last_my176 )177 capture_info.last_pos = (mx, my)178 if self.is_hit(mx, my):179 self.call_event_handler("mouse_hover", mx, my)180 if pyxel.btnp(capture_info.key, WIDGET_HOLD_TIME, WIDGET_REPEAT_TIME):181 self.call_event_handler("mouse_repeat", capture_info.key, mx, my)182 if pyxel.btnr(capture_info.key):183 self.call_event_handler("mouse_up", capture_info.key, mx, my)184 press_x, press_y = capture_info.press_pos185 if (186 pyxel.frame_count <= capture_info.time + WIDGET_CLICK_TIME187 and abs(pyxel.mouse_x - press_x) <= WIDGET_CLICK_DIST188 and abs(pyxel.mouse_y - press_y) <= WIDGET_CLICK_DIST189 ):190 self.call_event_handler("mouse_click", capture_info.key, mx, my)191 self._release_mouse()192 def _process_input(self):193 if not self._is_visible:194 return False195 if self._is_enabled:196 for widget in reversed(self._children):197 if widget._process_input():198 return True199 else:200 return False201 mx = pyxel.mouse_x202 my = pyxel.mouse_y203 if self.is_hit(mx, my):204 key = None205 if pyxel.btnp(pyxel.MOUSE_LEFT_BUTTON):206 key = pyxel.MOUSE_LEFT_BUTTON207 elif pyxel.btnp(pyxel.MOUSE_RIGHT_BUTTON):208 key = pyxel.MOUSE_RIGHT_BUTTON209 elif pyxel.btnp(pyxel.MOUSE_MIDDLE_BUTTON):210 key = pyxel.MOUSE_MIDDLE_BUTTON211 if key is not None:212 self._capture_mouse(key)213 self.call_event_handler("mouse_down", key, mx, my)214 self.call_event_handler("mouse_hover", mx, my)215 return True216 return False217 def _update(self):218 if not self._is_visible:219 return220 self.call_event_handler("update")221 for child in self._children:222 child._update()223 def draw_widgets(self):224 if not self._is_visible:225 return226 self.call_event_handler("draw")227 for child in self._children:...

Full Screen

Full Screen

DiaryViewController.py

Source:DiaryViewController.py Github

copy

Full Screen

1class DiaryViewController(object):2 def __init__(self):3 self._pages = [] 4 self._index = 05 self._is_visible = False6 @property7 def current_page_number(self):8 return self._index9 @current_page_number.setter 10 def current_page_number(self, value):11 new_index = value % len(self._pages)12 old_index = self._index13 self._index = new_index14 if old_index != new_index and self._is_visible:15 old_page = self.get_page(old_index)16 new_page = self.get_page(new_index)17 old_page.hide()18 new_page.show()19 20 def select_page(self, page_number):21 self.current_page_number = page_number22 @property23 def pages(self):24 return self._pages25 @property26 def total_pages(self):27 return len(self._pages)28 @property29 def current_page(self):30 return self._pages[self._index]31 @property32 def is_open(self):33 return self._is_visible34 def get_page(self, number):35 return self._pages[number % len(self._pages)]36 def append_page(self, page):37 if page not in self._pages:38 self._pages.append(page)39 40 def insert_page(self, page, index):41 if page not in self._pages:42 self._pages.insert(index, page)43 def open(self):44 self._is_visible = True45 self.current_page.show()46 def close(self):47 self._is_visible = False...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run robotframework-appiumlibrary automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful