コード例 #1
0
	def nextPrevTop(self, move):
		current = self.currentGet()
		allList = self.all()
		if not len(allList):
			return None
		if move == "top":
			chooseFileNamePath = allList[-1]
		else:
			inlist = util.itemInList(current, allList)
			if inlist:
				currentIndex = allList.index(current) 
				if (move == "next"):
					chooseNumber =  currentIndex + 1
					if chooseNumber >= len(allList):
						chooseNumber = 0
				elif move == "prev":
					chooseNumber =  currentIndex - 1
					if chooseNumber < 0:
						chooseNumber = -1
				chooseFileNamePath = allList[chooseNumber]
			elif len(allList):
				chooseFileNamePath = allList[-1]
			else:
				chooseFileNamePath = current
		self.currentSet(chooseFileNamePath)
		return chooseFileNamePath
コード例 #2
0
ファイル: inList_test.py プロジェクト: ypapax/sublime_util
	def test_testNameFalse(self):
		color.blue("test here baby")
		result = util.itemInList('3', ['1', '2'])
		expected = False
		self.assertEqual(result, expected)