IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Python Discussion :

Changer tout les <Pos> et <Size> dans un fichier skin.xml avec Python 2.7


Sujet :

Python

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant en sonorisation
    Inscrit en
    Septembre 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant en sonorisation
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut Changer tout les <Pos> et <Size> dans un fichier skin.xml avec Python 2.7
    Bonjour à tous,

    Je suis nouveau sur le forum et j'ai besoin d'aide. J’étudie en sonorisation et mon projet est de créer une façon de redimensionner un skin.xml (pour programme de mixage) pour différente taille d'écran.

    J'ai trouvé ce code sur un site :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    def calculatepos(match):
    # replace the two integer with scaled integers
    return '<Pos>%s%s,%s' % (str(int((int(match.group(1))*.625+0.5))),str(match.group(2)),str(int((int(match.group(3))*.75+0.5))))
    def calculate(match):
    # replace the two integer with scaled integers
    return '<Size>%s%s,%s' % (str(int((int(match.group(1))*.625+0.5))),str(match.group(2)),str(int((int(match.group(3))*.75+0.5))))
     
    editor.rereplace('<Pos>([0-9]+)(.*),([0-9]+)',calculatepos)
    62editor.rereplace('<Size>([0-9]+)(.*),([0-9]+)',calculate)
    Ma question est... comment exécuter ce code pour qu'il modifie tout les <Pos> et <Size> dans le fichier skin.xml ?

    J'utilise Python 2.7 et Notepad++ 6.0. Le fichier skin.xml contient + de 6000 lignes, donc, trop long à modifier manuellement.

    Merci pour votre aide !
    Clicker

  2. #2
    Expert confirmé
    Avatar de TiranusKBX
    Homme Profil pro
    Développeur C, C++, C#, Python, PHP, HTML, JS, Laravel, Vue.js
    Inscrit en
    Avril 2013
    Messages
    1 476
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur C, C++, C#, Python, PHP, HTML, JS, Laravel, Vue.js
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 1 476
    Points : 4 805
    Points
    4 805
    Billets dans le blog
    6
    Par défaut
    Citation Envoyé par Clicker Voir le message
    Bonjour à tous,

    Je suis nouveau sur le forum et j'ai besoin d'aide. J’étudie en sonorisation et mon projet est de créer une façon de redimensionner un skin.xml (pour programme de mixage) pour différente taille d'écran.

    J'ai trouvé ce code sur un site :

    def calculatepos(match):
    # replace the two integer with scaled integers
    return '<Pos>%s%s,%s' % (str(int((int(match.group(1))*.625+0.5))),str(match.group(2)),str(int((int(match.group(3))*.75+0.5))))
    def calculate(match):
    # replace the two integer with scaled integers
    return '<Size>%s%s,%s' % (str(int((int(match.group(1))*.625+0.5))),str(match.group(2)),str(int((int(match.group(3))*.75+0.5))))

    editor.rereplace('<Pos>([0-9]+)(.*),([0-9]+)',calculatepos)
    62editor.rereplace('<Size>([0-9]+)(.*),([0-9]+)',calculate)

    Ma question est... comment exécuter ce code pour qu'il modifie tout les <Pos> et <Size> dans le fichier skin.xml ?

    J'utilise Python 2.7 et Notepad++ 6.0. Le fichier skin.xml contient + de 6000 lignes, donc, trop long à modifier manuellement.

    Merci pour votre aide !
    Clicker
    il aurais été simpas que tu utilise la balise code pour nous faciliter la lecture
    sinon doit-je supposer que "editor" est ta variable contenant ton texte ?
    Rien, je n'ai plus rien de pertinent à ajouter

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant en sonorisation
    Inscrit en
    Septembre 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant en sonorisation
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Bonjour TiranusKBX,

    J'ai ajouté la balise... désolé, c'est mon premier message ici.

    Je suis débutant avec Python et le code que j'ai est celui d'un membre chez Mixxx Organisation et c'est avec ce code qu'il change les <Pos> et <Size> dans le fichier skin.xml.

    Le membre ne donne pas la méthode de procéder mais il se sert d'un script Python dans notepad++ pour faire les changements dans le fichier skin.xml et c'est cette 'méthode' que j'aimerais savoir.

    J'ai inclus 'une partie' du fichier skin.xml en balise pour que tu ais un idée.

    Pour ce qui est de ta question : ''doit-je supposer que "editor" est ta variable contenant ton texte ? '' et bien, surement les nouvelles valeur numérique de <Pos> et <Size> (Position et Grandeur) qu'il doit changer dans le fichier !

    Merci encore

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
     
     
    	<!--
    	Ghutalyn , Skin for Mixxx 1.10.x
    	www.mixxx.org
    	Copyright (C) 2011-2012 zezic ; zezic51@yandex.ru, zezic@jabber.ru
    	This file is part of the "Ghutalyn" Skin for Mixxx
    	"Ghutalyn" is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported license.
    	http://creativecommons.org/licenses/by-sa/3.0/
     
    	You are free:
    	to Share - to copy, distribute and transmit the work
    	to Remix - to adapt the work
     
    	Under the following conditions:
    	Attribution - You must attribute the work in the manner specified by the author or licensor
    	(but not in any way that suggests that they endorse you or your use of the work).
     
    	Share Alike - If you alter, transform, or build upon this work, you may distribute
    	the resulting work only under the same or similar license to this one.
     
    	CHANGELOG
    	v1.4	(30/05/2012)
    	*added waveform freq-colors for overview in decks and samplers
    	*KILL buttons fixed for 1.11
    	*waveform overview markers fixed for 1.11
     
    	v1.3	(25/05/2012)
    	*added waveform freq-colors for Mixxx 1.11
    	**KILL buttons don't work properly in 1.11
     
    	v1.2	(06/03/2012)
    	*fixed controls overlapping by vinyl mode switches and ffwd fbwd buttons
     
    	v1.1	(01/03/2012)
    	*skin adjusted for fullscreen mode
    	*1366x768 version now available
     
    	v1.0	(29/02/2012)
    	*fixed vinyl status indicators
     
    	v0.9a	(31/08/2011)
    	*initial 
    	-->
     
    <!DOCTYPE skin>
    <skin>
    	<!--
    	############################################################################################
    	############################################################################################
    	Mixxx skin documentation:
    	http://mixxx.org/wiki/doku.php/creating_skins
     
    	List of controls:
    	http://www.mixxx.org/wiki/doku.php/midi_controller_mapping_file_format#ui_midi_controls_and_names
     
    	Qt Style Sheets documentation:
    	http://doc.qt.nokia.com/latest/stylesheet.html
     
    	Debugging:
    	To outline WidgetGroups change all occurrences (exept this one ;-) of
    	"QGroupBox { border: 0px solid" to "QGroupBox { border: 1px solid"
     
    	Parent WidgedGroups are outlined one pixel solid red;
    		Child WidgedGroups are outlined one pixel solid yellow;
    			Grandchild WidgedGroups are outlined one pixel solid green;
    	############################################################################################
    	############################################################################################
    	-->
     
    	<!--
    	############################################################################################
    	############################################################################################
    	General- Main background picture
    	############################################################################################
    	############################################################################################
    	-->
    	<Background>
    		<Path>bg.png</Path>
    		<BgColor>#000000</BgColor>
    	</Background>
     
    	<!--
    	############################################################################################
    	############################################################################################
    	WidgetGroup : Show/hide Samplers and shrink Library
    	############################################################################################
    	############################################################################################
    	-->
    	<WidgetGroup>
    		<Pos>0,360</Pos>
    		<!--
    		<size> is optional, this will limit the size so that any part of a child widget outside of the size rectangle is not shown
    		<Size>w,h</Size>
    		-->
    		<Size>1280,416</Size>
    		<Layout>vertical</Layout>
    		<!--deactivate the standard
    		<Style>QGroupBox { border: 0px solid red; } QWidget { margin: 0; padding: 0; }</Style>
    		cause push buttons in library will show up with wrong margin/padding -->
    		<Style>QGroupBox { border: 0px solid red; }</Style>
    		<Children>
    			<!-- Sampler Bank sub-widget -->
    			<WidgetGroup>
    				<Size>i,110</Size>
    				<Layout>horizontal</Layout>
    				<Style>QGroupBox { border: 0px solid yellow; margin: 0px 0px 5px 0px;} </Style>
    				<Children>
    					<WidgetGroup>
    						<Pos>0,0</Pos>
    						<Size>150,120</Size>
    						<Style>QGroupBox { border: 0px solid green;  margin: -0px 0px 0px 0px; background: url(skin:micbg.png); } </Style>
    						<Children>
    			<!--
    			**********************************************
    			Visual- Volume peak indicator
    			**********************************************
    			-->
    			<StatusLight>
    				<Tooltip>Peak Indicator
    Indicates when the signal on the channel is clipping,
    (too loud for the hardware and is being distorted).
    </Tooltip>
    				<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    				background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    				</Style>
    				<PathStatusLight>btn_clipping_microphone_over.png</PathStatusLight>
    				<PathBack>btn_clipping_microphone.png</PathBack>
    				<Pos>121,17</Pos>
    				<Connection>
    					<ConfigKey>[Microphone],PeakIndicator</ConfigKey>
    				</Connection>
    			</StatusLight>
     
    			<!--
    			**********************************************
    			Visual - Volume level display
    			**********************************************
    			-->
    			<VuMeter>
    				<Tooltip>Microphone volume meter
    Outputs the current instantaneous microphone volume
    </Tooltip>
    				<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    				background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    				</Style>
    				<PathVu>micvu.png</PathVu>
    				<PathBack>micvubg.png</PathBack>
    				<Pos>7,65</Pos>
    				<Horizontal>true</Horizontal>
    				<PeakHoldSize>5</PeakHoldSize>
    				<PeakHoldTime>500</PeakHoldTime>
    				<PeakFallTime>50</PeakFallTime>
    				<PeakFallStep>2</PeakFallStep>
    				<Connection>
    					<ConfigKey>[Microphone],VuMeter</ConfigKey>
    				</Connection>
    			</VuMeter>
     
    			<!--
    			**********************************************
    			Button- Mix Orientation (Routing)
    			**********************************************
    			-->
    			<PushButton>
    				<Tooltip>Mix orientation
    Set the channel's mix orientation.
    L = left side of crossfader, R = right side of crossfader, M = center (default)
    </Tooltip>
    				<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    				background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    				</Style>
    				<NumberStates>3</NumberStates>
    				<State>
    					<Number>0</Number>
    					<Pressed>micdir0.png</Pressed>
    					<Unpressed>micdir0.png</Unpressed>
    				</State>
    				<State>
    					<Number>1</Number>
    					<Pressed>micdir1.png</Pressed>
    					<Unpressed>micdir1.png</Unpressed>
    				</State>
    				<State>
    					<Number>2</Number>
    					<Pressed>micdir2.png</Pressed>
    					<Unpressed>micdir2.png</Unpressed>
    				</State>
    				<Pos>72,56</Pos>
    				<Connection>
    					<ConfigKey>[Microphone],orientation</ConfigKey>
    					<EmitOnDownPress>true</EmitOnDownPress>
    					<ButtonState>LeftButton</ButtonState>
    				</Connection>
    			</PushButton>
     
    			<!--
    			**********************************************
    			Knob- Channel Volume
    			**********************************************
    			-->
    			<Knob>
    				<Tooltip>Microphone volume
    Adjusts the microphone volume.
    Right-click: Reset to default value
    </Tooltip>
    				<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    				background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    				</Style>
    				<NumberStates>122</NumberStates>
    				<Path>knoborange/%1.png</Path>
    				<Pos>85,10</Pos>
    				<Connection>
    					<ConfigKey>[Microphone],volume</ConfigKey>
    				</Connection>
    			</Knob>
     
    			<!--
    			****************************************
    			Button- Talkover
    			****************************************
    			-->
    			<PushButton>
    				<Tooltip>Talkover
    Hold-to-talk and mix microphone input into the master output.
    </Tooltip>
    				<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    				background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    				</Style>
    				<NumberStates>1</NumberStates>
    				<State>
    					<Number>0</Number>
    					<Pressed>air1.png</Pressed>
    					<Unpressed>air0.png</Unpressed>
    				</State>
    				<Pos>0,5</Pos>
    				<Connection>
    					<ConfigKey>[Microphone],talkover</ConfigKey>
    					<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    					<ButtonState>LeftButton</ButtonState>
    				</Connection>
    			</PushButton>
    						</Children>
    					</WidgetGroup>
    					<!-- all sub-widgets for the 4 samplers -->
    					<WidgetGroup>
    						<Pos>0,0</Pos>
    						<Size>220,120</Size>
    						<Style>QGroupBox { border: 0px solid green;  margin: -0px 0px 0px 0px; background: url(skin:samplerbg.png); } </Style>
    						<Children>
    							<!--
    							**********************************************
    							Text- Track Title
    							**********************************************
    							-->
     
    							<TrackProperty>
    								<Tooltip>Track title
    Displays the artist and title of the loaded track.
    Informations are extracted from the tracks tags.
    </Tooltip>
    								<Style>QLabel { font: 13px/15px Ubuntu, Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: transparent; color: #777777; text-align: left; padding-left: 1px; }
    								QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<Property>title</Property>
    								<Group>[Sampler1]</Group>
    								<Pos>2,71</Pos>
    								<Size>102,16</Size>
    							</TrackProperty>
     
     
    							<!--
    							**********************************************
    							Text- BPM number display
    							**********************************************
    							-->
    							<NumberBpm>
    								<Tooltip>Tempo
    Displays the tempo of the loaded track in BPM (beats per minute)
    </Tooltip>
    								<Style>QLabel { font: 13px/15px Ubuntu, Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: transparent; color: #777777; text-align: left; padding-left: 1px; }
    								QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<Group>[Sampler1]</Group>
    								<Pos>66,71</Pos>
    								<Size>48,16</Size>
    								<!--CSS alignments not respected see bug lp:605530 , lets call <Alignment>-->
    								<Alignment>right</Alignment>
    								<Connection>
    									<ConfigKey>[Sampler1],bpm</ConfigKey>
    								</Connection>
    							</NumberBpm>
     
    							<!--
    							**********************************************
    							Button- BPM Tap
    							**********************************************
    							-->
    							<!-- Little trickery here:
    								 BPM tap is transparent png directly over BPM display, so it became BPM and TAP at once,
    								 changed tooltip accordingly
    							-->
    							<PushButton>
    							<!-- Original:
    								<Tooltip>BPM Tap
    When tapped repeatedly, adjusts the BPM to match the tapped BPM
    </Tooltip>
    							-->
    								<Tooltip>Tempo and BPM tap
    Displays the tempo of the loaded track in BPM (beats per minute)
    When tapped repeatedly, adjusts the BPM to match the tapped BPM
    </Tooltip>
     
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>1</NumberStates>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplertap1.png</Pressed>
    									<Unpressed>samplertap0.png</Unpressed>
    								</State>
    									<Pos>69,68</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],bpm_tap</ConfigKey>
    										<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    								</Connection>
    							</PushButton>
     
    							<!--
    							**********************************************
    							Visual- Waveform overview
    							**********************************************
    							-->
    							<Overview>
    								<Tooltip>Waveform overview
    Shows information about the track currently loaded in this channel.
    Jump around in the track by clicking somewhere on the waveform.
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								background: {
    								</Style>
    								<Group>[Sampler1]</Group>
    								<Pos>4,30</Pos>
    								<Size>149,30</Size>
    								<SignalColor>#444444</SignalColor>
    								<SignalLowColor>#cd0041</SignalLowColor>
    								<SignalMidColor>#ff8900</SignalMidColor>
    								<SignalHighColor>#FFFFFF</SignalHighColor>
    								<MarkerColor>#557755</MarkerColor>
    								<Connection>
    									<ConfigKey>[Sampler1],playposition</ConfigKey>
    									<EmitOnDownPress>false</EmitOnDownPress>
    								</Connection>
    							</Overview>
     
    							<!--
    							**********************************************
    							RotaryFader- Gain
    							**********************************************
    							-->
    							<Knob>
    								<Tooltip>Gain
    Adjusts the pre-fader gain of the track (to avoid clipping)
    Right-click: Reset to default value
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>150</NumberStates>
    								<Path>samplervol/%1.png</Path>
    								<Pos>4,60</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],pregain</ConfigKey>
    								</Connection>
    							</Knob>
     
    							<!--
    							**********************************************
    							Visual- Volume peak indicator
    							**********************************************
    							-->
    							<StatusLight>
    								<Tooltip>Peak Indicator
    Indicates when the signal on the channel is clipping,
    (too loud for the hardware and is being distorted).
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<PathStatusLight>btn_clipping_sampler_over.png</PathStatusLight>
    								<PathBack>btn_clipping_sampler.png</PathBack>
    								<Pos>167,2</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],PeakIndicator</ConfigKey>
    								</Connection>
    							</StatusLight>
     
    							<!--
    							**********************************************
    							Visual - Volume level display
    							**********************************************
    							-->
    							<VuMeter>
    								<Tooltip>Channel volume meter
    Shows the current channel volume
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<PathVu>samplervu.png</PathVu>
    								<PathBack>samplervu0.png</PathBack>
    								<Pos>4,53</Pos>
    								<Horizontal>true</Horizontal>
    								<PeakHoldSize>5</PeakHoldSize>
    								<PeakHoldTime>500</PeakHoldTime>
    								<PeakFallTime>50</PeakFallTime>
    								<PeakFallStep>2</PeakFallStep>
    								<Connection>
    									<ConfigKey>[Sampler1],VuMeter</ConfigKey>
    								</Connection>
    							</VuMeter>
     
    							<!--
    							**********************************************
    							Slider- Pitch control
    							**********************************************
    							-->
    							<SliderComposed>
    								<Tooltip>Pitch control
    Changes the tempo of the track currently loaded when it is moved
    Right-click: Reset to default value
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<Handle>fadervs.png</Handle>
    								<Slider>samplerpitchbg.png</Slider>
    								<Pos>116,4</Pos>
    								<Horizontal>false</Horizontal>
    								<Connection>
    									<ConfigKey>[Sampler1],rate</ConfigKey>
    									<EmitOnDownPress>false</EmitOnDownPress>
    								</Connection>
    							</SliderComposed>
     
    							<!--
    							****************************************
    							 Button- Play
    							****************************************
    							-->
    							<PushButton>
    								<Tooltip>Play/Pause
    Left-click: Toggles playing or pausing the track.
    Right-click: Jumps to the beginning of the track.
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerplay0.png</Pressed>
    									<Unpressed>samplerplay0.png</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerplay1.png</Pressed>
    									<Unpressed>samplerplay1.png</Unpressed>
    								</State>
    								<Pos>97,4</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],play</ConfigKey>
    									<EmitOnDownPress>true</EmitOnDownPress>
    									<ButtonState>LeftButton</ButtonState>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],start</ConfigKey>
    									<EmitOnDownPress>true</EmitOnDownPress>
    									<ButtonState>RightButton</ButtonState>
    								</Connection>
    							</PushButton>
     
    							<!--
    							**********************************************
    							Button- Hotcue
    							**********************************************
    							-->
    							<PushButton>
    								<Tooltip>Hotcue
    Left-click: If Hotcue is set, seeks the player to Hotcue position.
    If Hotcue is not set, sets Hotcue to the current play position.
    Right-click: If Hotcue is set, clears its hotcue status (delete).
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<LeftClickIsPushButton>true</LeftClickIsPushButton>
    								<RightClickIsPushButton>true</RightClickIsPushButton>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerhotcue11.png</Pressed>
    									<Unpressed>samplerhotcue10</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerhotcue10</Pressed>
    									<Unpressed>samplerhotcue11.png</Unpressed>
    								</State>
    								<Pos>0,4</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_1_activate</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>LeftButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_1_clear</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>RightButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_1_enabled</ConfigKey>
    									<ConnectValueFromWidget>false</ConnectValueFromWidget>
    								</Connection>
    							</PushButton>
    							<PushButton>
    								<Tooltip>Hotcue
    Left-click: If Hotcue is set, seeks the player to Hotcue position.
    If Hotcue is not set, sets Hotcue to the current play position.
    Right-click: If Hotcue is set, clears its hotcue status (delete).
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<LeftClickIsPushButton>true</LeftClickIsPushButton>
    								<RightClickIsPushButton>true</RightClickIsPushButton>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerhotcue21.png</Pressed>
    									<Unpressed>samplerhotcue20</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerhotcue20</Pressed>
    									<Unpressed>samplerhotcue21.png</Unpressed>
    								</State>
    								<Pos>35,5</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_2_activate</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>LeftButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_2_clear</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>RightButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_2_enabled</ConfigKey>
    									<ConnectValueFromWidget>false</ConnectValueFromWidget>
    								</Connection>
    							</PushButton>
    							<PushButton>
    								<Tooltip>Hotcue
    Left-click: If Hotcue is set, seeks the player to Hotcue position.
    If Hotcue is not set, sets Hotcue to the current play position.
    Right-click: If Hotcue is set, clears its hotcue status (delete).
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<LeftClickIsPushButton>true</LeftClickIsPushButton>
    								<RightClickIsPushButton>true</RightClickIsPushButton>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerhotcue31.png</Pressed>
    									<Unpressed>samplerhotcue30</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerhotcue30</Pressed>
    									<Unpressed>samplerhotcue31.png</Unpressed>
    								</State>
    								<Pos>41,4</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_3_activate</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>LeftButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_3_clear</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>RightButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_3_enabled</ConfigKey>
    									<ConnectValueFromWidget>false</ConnectValueFromWidget>
    								</Connection>
    							</PushButton>
    							<PushButton>
    								<Tooltip>Hotcue
    Left-click: If Hotcue is set, seeks the player to Hotcue position.
    If Hotcue is not set, sets Hotcue to the current play position.
    Right-click: If Hotcue is set, clears its hotcue status (delete).
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<LeftClickIsPushButton>true</LeftClickIsPushButton>
    								<RightClickIsPushButton>true</RightClickIsPushButton>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerhotcue41.png</Pressed>
    									<Unpressed>samplerhotcue40</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerhotcue40</Pressed>
    									<Unpressed>samplerhotcue41.png</Unpressed>
    								</State>
    								<Pos>59,4</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_4_activate</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>LeftButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_4_clear</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>RightButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    								<Connection>
    									<ConfigKey>[Sampler1],hotcue_4_enabled</ConfigKey>
    									<ConnectValueFromWidget>false</ConnectValueFromWidget>
    								</Connection>
    							</PushButton>
     
    							<!--
    							**********************************************
    							Button- Prelisten / Monitoring
    							**********************************************
    							-->
    							<PushButton>
    								<Tooltip>Headphone
    Sends the selected channel's audio to the Headphones output audio device
    selected in Preferences→Sound Hardware.
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerpfl0.png</Pressed>
    									<Unpressed>samplerpfl0.png</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerpfl1.png</Pressed>
    									<Unpressed>samplerpfl1.png</Unpressed>
    								</State>
    								<Pos>78,4</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],pfl</ConfigKey>
    								</Connection>
    							</PushButton>
     
    							<!--
    							**********************************************
    							Button- Eject
    							**********************************************
    							-->
    							<PushButton>
    								<Tooltip>Eject
    Eject currently loaded track from player.
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>1</NumberStates>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerunload1.png</Pressed>
    									<Unpressed>samplerunload0.png</Unpressed>
    								</State>
    								<Pos>4,68</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],eject</ConfigKey>
    									<EmitOnPressAndRelease>true</EmitOnPressAndRelease>
    									<ButtonState>LeftButton</ButtonState>
    									<ConnectValueToWidget>false</ConnectValueToWidget>
    								</Connection>
    							</PushButton>
     
    							<!--
    							**********************************************
    							Button- Repeat (End of track mode)
    							**********************************************
    							-->
    							<PushButton>
    								<Tooltip>Repeat
    When active the track will repeat if you go past the end or reverse before the start.
    </Tooltip>
    								<Style>QToolTip { font: 11px Lucida Grande, Lucida Sans Unicode, Arial, Verdana, sans-serif;
    								background-color: #191919; color: #CCCCCC; border: 1px solid #CCCCCC; padding: 4px; }
    								</Style>
    								<NumberStates>2</NumberStates>
    								<State>
    									<Number>0</Number>
    									<Pressed>samplerrepeat0.png</Pressed>
    									<Unpressed>samplerrepeat0.png</Unpressed>
    								</State>
    								<State>
    									<Number>1</Number>
    									<Pressed>samplerrepeat1.png</Pressed>
    									<Unpressed>samplerrepeat1.png</Unpressed>
    								</State>
    								<Pos>97,30</Pos>
    								<Connection>
    									<ConfigKey>[Sampler1],repeat</ConfigKey>
    								</Connection>
    							</PushButton>
     
    							<!--

  4. #4
    Expert confirmé
    Avatar de TiranusKBX
    Homme Profil pro
    Développeur C, C++, C#, Python, PHP, HTML, JS, Laravel, Vue.js
    Inscrit en
    Avril 2013
    Messages
    1 476
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Seine et Marne (Île de France)

    Informations professionnelles :
    Activité : Développeur C, C++, C#, Python, PHP, HTML, JS, Laravel, Vue.js
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 1 476
    Points : 4 805
    Points
    4 805
    Billets dans le blog
    6
    Par défaut
    Alors je vois

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
     
    import re
    import os
     
    file = open("adresse_fichier", "r");
    editor= file.readlines();
    file.close();
     
    editor = re.sub('<Pos>([0-9]+)(.*),([0-9]+)<\/Pos>', '<Pos>{0}{1},{2}'.format((str(int((int(match.group(1))*.625+0.5)))+'</Pos>',
    str(match.group(2)),
    str(int((int(match.group(3))*.75+0.5))))), editor)
     
    editor = re.sub('<Size>([0-9]+)(.*),([0-9]+)<\/Size>', '<Size>{0}{1},{2}' .format((str(int((int(match.group(1))*.625+0.5)))+'</Size>',
    str(match.group(2)),
    str(int((int(match.group(3))*.75+0.5))))), editor)
     
    file = open("adresse_fichier", "w");
    file.write(editor);
    file.close();
    par contre teste le avant sur une copie de fichier
    vus que je ne suis pas certain du résultat

    EDIT : J'ai oublié de refaire tes calculs ^^
    Rien, je n'ai plus rien de pertinent à ajouter

  5. #5
    Nouveau Candidat au Club
    Homme Profil pro
    Étudiant en sonorisation
    Inscrit en
    Septembre 2014
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant en sonorisation
    Secteur : Enseignement

    Informations forums :
    Inscription : Septembre 2014
    Messages : 3
    Points : 1
    Points
    1
    Par défaut
    Merci pour ton coup de main,

    Je vais t'expliquer la façon que j'ai procédé et dis moi si c'est correcte,

    a) j'ai installé le script PyNPP.dll dans les Compléments de Notepad++

    b) Le chemin du fichier skin.xml à été inclus dans le code

    c) TON nouveau code s'appelle ( New_Converter.py ) (sans les parenthèses, bien entendu !)

    d) à partir de PyNPP, j'ai fais la commande : ''Run file In Python Interactive'


    Le résultat est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     Traceback (most recent call last):
      File "C:\Users\Jos\Desktop\New_Converter.py", line 10, in <module>
        editor = re.sub('<Pos>([0-9]+)(.*),([0-9]+)<\/Pos>', '<Pos>{0}{1},{2}'.forma
    t((str(int((int(match.group(1))*.625+0.5)))+'</Pos>',
    NameError: name 'match' is not defined
    >>>
    Merci encore pour ton temps
    Clicker

Discussions similaires

  1. [LibreOffice][Texte] Macro pour changer toutes les polices de tous les styles
    Par Nerva dans le forum OpenOffice & LibreOffice
    Réponses: 3
    Dernier message: 24/06/2013, 10h58
  2. [XL-2007] changer toutes les liaisons simplement?
    Par EmmanuelleC dans le forum Excel
    Réponses: 2
    Dernier message: 30/09/2010, 15h07
  3. Réponses: 0
    Dernier message: 23/11/2009, 18h35
  4. [BO] changer toutes les connexions d'un rapport
    Par arnauann dans le forum Deski
    Réponses: 2
    Dernier message: 24/08/2007, 11h30
  5. [SWING][JTable]Changer toutes les donnees
    Par yciabaud dans le forum Composants
    Réponses: 1
    Dernier message: 05/08/2006, 20h28

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo