Skip to content

Commit

Permalink
bugfix/take-screenshot-twice (#51)
Browse files Browse the repository at this point in the history
* Take screenshot twice when click an unselected device's take-screenshot-button

* Add GitHub actions
  • Loading branch information
yumiguan authored Nov 17, 2020
1 parent 4614e75 commit bc6c66d
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 52 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Publish to pypi

on:
release:
types: [created]

jobs:
build-n-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: "10"
- name: Install npm Dependencies
run: |
cd frontend
npm install
npm run build
cd ..
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*
22 changes: 22 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Unit Test

on: [push, pull_request]

jobs:
unittest:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.7"
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Unit Test
run: |
cd tests
python -m pytest .
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions frontend/src/components/DeviceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export default {
},
methods: {
onCellClick (deviceId) {
this.$store.commit('setFocusDeviceId', deviceId)
this.$store.commit('setDeviceInfo', this.devices[deviceId])
this.$store.dispatch('loadPackages')
this.$store.dispatch('takeScreenShot')
if (this.focusDeviceId !== deviceId) {
this.$store.commit('setFocusDeviceId', deviceId)
this.$store.dispatch('initAllDeviceInfo')
}
},
takeScreenShot () {
if (this.focusDeviceId) {
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,28 @@ export default new Vuex.Store({
}
},
actions: {
loadDevices ({ state, commit }) {
loadDevices ({ state, commit, dispatch }) {
api.getDevices().then(response => {
commit('setDevices', response.data.device_list)
if (!state.devices.hasOwnProperty(state.focusDeviceId)) {
if (Object.keys(state.devices).length > 0) {
commit('setFocusDeviceId', Object.keys(state.devices)[0])
dispatch('initAllDeviceInfo')
} else {
commit('setFocusDeviceId', null)
commit('setScreenShotUrl', null)
dispatch('clearAllDeviceInfo')
}
})
},
initAllDeviceInfo ({state, commit, dispatch}) {
commit('setDeviceInfo', state.devices[state.focusDeviceId])
dispatch('loadPackages')
dispatch('takeScreenShot')
},
clearAllDeviceInfo ({commit, dispatch}) {
commit('setDeviceInfo', {})
commit('setScreenShotUrl', null)
commit('setPackages', [])
},
takeScreenShot ({ state, commit }) {
commit('setIsTakingScreen', true)
api.getScreenShot(state.focusDeviceId).then(response => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/store/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export default {
api.launchApp(deviceId, packageName, state.launchActions)
.then(response => {
commit('setIsStartingApp', false)
bus.$emit('msg.success', 'Start App ' + state.focusPackageName + ' success!')
bus.$emit('msg.success', 'Start App ' + packageName + ' success!')
})
.catch(error => {
bus.$emit('msg.error', 'Start App ' + state.focusPackageName + ' error: ' + error.data.message)
bus.$emit('msg.error', 'Start App ' + packageName + ' error: ' + error.data.message)
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lyrebird
-e .[dev]
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='lyrebird-android',
version='0.5.7',
version='0.5.8',
packages=['lyrebird_android'],
url='https://github.com/meituan/lyrebird-android',
author='HBQA',
Expand All @@ -29,5 +29,12 @@
},
install_requires=[
'lyrebird'
]
],
extras_require={
'dev': [
"autopep8",
"pylint",
"pytest"
]
}
)

0 comments on commit bc6c66d

Please sign in to comment.