How to use selecttabindex method in pyatom

Best Python code snippet using pyatom_python

ui_shared.py

Source:ui_shared.py Github

copy

Full Screen

1# --------------------------------------------------------------------------------------------2# Copyright (c) Microsoft Corporation. All rights reserved.3# Licensed under the MIT License. See License.txt in the project root for license information.4# --------------------------------------------------------------------------------------------5import os6from azurebatchmayaapi import MayaAPI as maya7class AzureBatchUI(object):8 """Class to create the plug-in UI frame into which all the tabs 9 will be loaded.10 """11 def __init__(self, base):12 """Create and open plug-in UI."""13 self.base = base14 if (maya.window("AzureBatch", q=1, exists=1)):15 maya.delete_ui("AzureBatch")16 self.ui = maya.window("AzureBatch",17 title="Azure Batch Maya Client v{0}".format(18 os.environ["AZUREBATCH_VERSION"]),19 sizeable=True,20 height=450,21 resizeToFitChildren=True)22 self.form = maya.form_layout()23 self.tab_display = maya.tab_layout(innerMarginWidth=5,24 innerMarginHeight=5,25 preventOverride=False,26 selectCommand=self.change_tab,27 childResizable=True)28 maya.form_layout(self.form,29 edit=True,30 attachForm=((self.tab_display, 'top', 0),31 (self.tab_display, 'left', 0),32 (self.tab_display, 'bottom', 0),33 (self.tab_display, 'right', 0)))34 self.tabs = []35 maya.window(self.ui,36 edit=True,37 width=420,38 height=620)39 maya.show(self.ui)40 maya.refresh()41 def is_logged_out(self):42 """Called when plug-in is logged out. Iterates through all UI tabs43 and sets them to logged-out state, and resets whether they have44 been loaded.45 Sets config/authentication tab as the display tab.46 """47 maya.tab_layout(self.tab_display, edit=True, selectTabIndex=1)48 for page in self.tabs:49 page.ready = False50 page.is_logged_out()51 def is_logged_in(self):52 """Called when the plug-in is authenticated. Sets the Config tab as53 the display tab.54 """55 maya.tab_layout(self.tab_display, edit=True, selectTabIndex=1)56 self.tabs[0].is_logged_in()57 def change_tab(self, *args):58 """Called when a user clicks on a tab to display it.59 Initiates the loading of that tabs contents.60 """61 if self.base.config.auth:62 selected = maya.tab_layout(self.tab_display, query=True, selectTabIndex=True)63 selected_tab = self.tabs[selected-1]64 selected_tab.prepare()65 def select_tab(self, tab):66 """Select a specific tab for display.67 :param int tab: The index of the tab to display.68 """69 maya.tab_layout(self.tab_display, edit=True, selectTabIndex=tab)70 def selected_tab(self):71 """Get the index of the currently selected tab.72 :returns: The index (int) of the currently selected tab.73 """74 return maya.tab_layout(75 self.tab_display, query=True, selectTabIndex=True)76 def add_tab(self, content):77 """Add a new tab to the display layout.78 Content must have a ``page`` attribute as it's primary layout.79 :param content: This is called by any of the tab UI classes to80 add themselves to the plug-in UI.81 :type content: :class:`AzureBatchUI`82 """83 maya.form_layout(content.page, edit=True, parent=self.tab_display)84 self.tabs.append(content)85 new_layout = []86 for t in self.tabs:87 new_layout.append((str(t.page), t.label))88 new_layout = tuple(new_layout)...

Full Screen

Full Screen

pagetablist.py

Source:pagetablist.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp4#5# Description:6# This set of test scripts will test the LDTP framework for correct7# functioning of its APIs. This is a Regression Suite.8#9# Author:10# Prashanth Mohan <prashmohan@gmail.com>11#12#13# This test script is free software; you can redistribute it and/or14# modify it under the terms of the GNU Library General Public15# License as published by the Free Software Foundation; either16# version 2 of the License, or (at your option) any later version.17#18# This library is distributed in the hope that it will be useful,19# but WITHOUT ANY WARRANTY; without even the implied warranty of20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU21# Library General Public License for more details.22#23# You should have received a copy of the GNU Library General Public24# License along with this library; if not, write to the25# Free Software Foundation, Inc., 59 Temple Place - Suite 330,26# Boston, MA 02111-1307, USA.27#28from regression import *29import random, os30try:31 check_open('gedit')32except:33 raise34data_object = LdtpDataFileParser (datafilename)35tab_count = data_object.gettagvalue ('tabcount')36if tab_count == []:37 tab_count = 538else:39 tab_count = int(tab_count[0])40pref = '*Pref*'41log ('tab list count','teststart')42try:43 open_pref()44 count = gettabcount (pref,'ptl0')45 if count != tab_count:46 log ('number of tabs do not tally','cause')47 raise LdtpExecutionError (str (traceback.format_exc ()))48except:49 testfail ('tab list count')50 raise LdtpExecutionError (str (traceback.format_exc ()))51testpass ('tab list count')52log ('selecttab','teststart')53try:54 open_pref()55 obj = [ x for x in getobjectlist(pref) if x.startswith ('ptab')]56 if selecttab (pref,'ptl0','View') == 0:57 log ('Unable to select tab','cause')58 raise LdtpExecutionError (str (traceback.format_exc ()))59 if selecttab (pref,'ptl0','Editor') == 0:60 log ('Unable to select tab','cause')61 raise LdtpExecutionError (str (traceback.format_exc ()))62 if selecttab (pref,'ptl0','Font & Colors') == 0:63 log ('Unable to select tab','cause')64 raise LdtpExecutionError (str (traceback.format_exc ()))65 if selecttab (pref,'ptl0','Syntax Highlighting') == 0:66 log ('Unable to select tab','cause')67 raise LdtpExecutionError (str (traceback.format_exc ()))68 if selecttab (pref,'ptl0','Plugins') == 0:69 log ('Unable to select tab','cause')70 raise LdtpExecutionError (str (traceback.format_exc ()))71# for tab in obj:72# if selecttab (pref,'ptl0',tab[4:]) == 0:73# log ('Unable to select tab','cause')74# raise LdtpExecutionError (str (traceback.format_exc ()))75except:76 testfail ('selecttab')77 raise LdtpExecutionError (str (traceback.format_exc ()))78testpass ('selecttab')79log ('selecttabindex','teststart')80try:81 for ind in range (tab_count):82 if selecttabindex (pref,'ptl0',ind) == 0:83 log ('Unable to select tab','cause')84 raise LdtpExecutionError (str (traceback.format_exc ()))85 click (pref,'btnClose')86 waittillguinotexist (pref)87except:88 testfail ('selecttabindex')89 raise LdtpExecutionError (str (traceback.format_exc ()))...

Full Screen

Full Screen

fx_collapse_shelf_buttons.py

Source:fx_collapse_shelf_buttons.py Github

copy

Full Screen

1# fx_collapse_shelf_buttons.collapse_group = group_name2# // fx_collapse_shelf_buttons.collapse_group = group_name3import re4import maya.mel as mel5import maya.cmds as m6import pymel.core as pm7OPT_VAR_PREFIX = 'fx_collapse_shelf_buttons_'8def toggle(shelf, group):9 state = toggleState(getSavedState(shelf, group))10 setGroupState(shelf, group, state)11 saveState(shelf, group, state)12def toggleState(state):13 return 1 if state == 0 else 014def setGroupState(shelf, group, state):15 shelves = getShelves()16 assert shelf in shelves, 'Cannot find shelf "' + shelf + '".'17 shelfButtons = m.shelfLayout(shelf, query=True, childArray=True, fullPathName=True)18 for btn in shelfButtons:19 btnCommandString = m.shelfButton(btn, q=True, command=True)20 match = re.search(r'.*fx_collapse_shelf_buttons\.collapse_group\s*=\s*' + re.escape(group) + r'\s+.*',21 btnCommandString)22 if match:23 m.shelfButton(btn, e=True, visible=state)24 pattern = r"fx_collapse_shelf_buttons.toggle\(\'" + re.escape(shelf) + r"\'\,\s*\'" + re.escape(group) + r"\'\)"25 match = re.search(pattern, btnCommandString)26 if match:27 image = 'collapseBarOpened.png' if state else 'collapseBarClosed.png'28 m.shelfButton(btn, e=True, image=image, image1=image)29def initCollapse():30 # need to activate each tab. if you dont you'll get an empty array of buttons if you query them31 cycleThroughShelves()32 for shelf in getShelves():33 shelfButtons = m.shelfLayout(shelf, query=True, childArray=True, fullPathName=True)34 if shelfButtons is not None:35 for btn in shelfButtons:36 try:37 btnCommandString = m.shelfButton(btn, q=True, command=True)38 except RuntimeError:39 continue40 match = re.search(r"fx_collapse_shelf_buttons.toggle\(\'(.*)\'\,\s*\'(.*)\'\)", btnCommandString)41 if match:42 shelf, group = match.group(1), match.group(2)43 state = getSavedState(shelf, group)44 setGroupState(shelf, group, state)45def getShelves():46 return m.tabLayout(getShelfTopLevel(), q=True, childArray=True)47def cycleThroughShelves():48 shelfTopLevel = getShelfTopLevel()49 currentTabIndex = m.shelfTabLayout(shelfTopLevel, q=True, selectTabIndex=True)50 shelves = getShelves()51 for i in range(1, len(shelves) + 1):52 m.shelfTabLayout(shelfTopLevel, e=True, selectTabIndex=i)53 m.shelfTabLayout(shelfTopLevel, e=True, selectTabIndex=currentTabIndex)54def getShelfTopLevel():55 return mel.eval('global string $gShelfTopLevel; $temp = $gShelfTopLevel')56def getSavedState(shelf, group):57 optVarName = OPT_VAR_PREFIX + shelf + '_' + group58 optVars = pm.env.optionVars59 if optVarName not in optVars:60 optVars[optVarName] = 161 return optVars[optVarName]62def saveState(shelf, group, state):63 optVarName = OPT_VAR_PREFIX + shelf + '_' + group64 optVars = pm.env.optionVars...

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 pyatom 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