Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 8f55a76

Browse files
committed
Merge branch 'main' of https://github.com/QuinterApp/Quinter into main
2 parents cb198a5 + 1c56c0f commit 8f55a76

18 files changed

Lines changed: 132 additions & 110 deletions

GUI/invisible.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def register_key(key,name,reg=True):
77
if hasattr(main.window,name):
88
try:
9-
if reg==True:
9+
if reg:
1010
main.window.handler.register_key(key,getattr(main.window,name))
1111
else:
1212
main.window.handler.unregister_key(key,getattr(main.window,name))
@@ -15,7 +15,7 @@ def register_key(key,name,reg=True):
1515
return False
1616
if hasattr(main.window,"on"+name):
1717
try:
18-
if reg==True:
18+
if reg:
1919
main.window.handler.register_key(key,getattr(main.window,"on"+name))
2020
else:
2121
main.window.handler.unregister_key(key,getattr(main.window,"on"+name))
@@ -24,7 +24,7 @@ def register_key(key,name,reg=True):
2424
return False
2525
if hasattr(main.window,"On"+name):
2626
try:
27-
if reg==True:
27+
if reg:
2828
main.window.handler.register_key(key,getattr(main.window,"On"+name))
2929
else:
3030
main.window.handler.unregister_key(key,getattr(main.window,"On"+name))
@@ -33,7 +33,7 @@ def register_key(key,name,reg=True):
3333
return False
3434
if hasattr(inv,name):
3535
try:
36-
if reg==True:
36+
if reg:
3737
main.window.handler.register_key(key,getattr(inv,name))
3838
else:
3939
main.window.handler.unregister_key(key,getattr(inv,name))
@@ -44,29 +44,29 @@ def register_key(key,name,reg=True):
4444
class invisible_interface(object):
4545
def focus_tl(self,sync=False):
4646
globals.currentAccount.currentTimeline=globals.currentAccount.list_timelines()[globals.currentAccount.currentIndex]
47-
if sync==False and globals.prefs.invisible_sync==True or sync==True:
47+
if not sync and globals.prefs.invisible_sync or sync:
4848
main.window.list.SetSelection(globals.currentAccount.currentIndex)
4949
main.window.on_list_change(None)
5050
extratext=""
51-
if globals.prefs.position==True:
51+
if globals.prefs.position:
5252
if len(globals.currentAccount.currentTimeline.statuses)==0:
5353
extratext+="Empty"
5454
else:
5555
extratext+=str(globals.currentAccount.currentTimeline.index+1)+" of "+str(len(globals.currentAccount.currentTimeline.statuses))
56-
if globals.currentAccount.currentTimeline.read==True:
56+
if globals.currentAccount.currentTimeline.read:
5757
extratext+=", Autoread"
58-
if globals.currentAccount.currentTimeline.mute==True:
58+
if globals.currentAccount.currentTimeline.mute:
5959
extratext+=", muted"
6060
speak.speak(globals.currentAccount.currentTimeline.name+". "+extratext,True)
61-
if globals.prefs.invisible_sync==False and sync==False:
61+
if not globals.prefs.invisible_sync and not sync:
6262
main.window.play_earcon()
6363

6464
def focus_tl_item(self):
65-
if globals.prefs.invisible_sync==True:
65+
if globals.prefs.invisible_sync:
6666
main.window.list2.SetSelection(globals.currentAccount.currentTimeline.index)
6767
main.window.on_list2_change(None)
6868
else:
69-
if globals.prefs.earcon_audio==True and len(sound.get_media_urls(utils.find_urls_in_tweet(globals.currentAccount.currentTimeline.statuses[globals.currentAccount.currentTimeline.index])))>0:
69+
if globals.prefs.earcon_audio and len(sound.get_media_urls(utils.find_urls_in_tweet(globals.currentAccount.currentTimeline.statuses[globals.currentAccount.currentTimeline.index]))) > 0:
7070
sound.play(globals.currentAccount,"media")
7171
self.speak_item()
7272

@@ -91,19 +91,19 @@ def next_tl(self,sync=False):
9191
def prev_item(self):
9292
if globals.currentAccount.currentTimeline.index==0 or len(globals.currentAccount.currentTimeline.statuses)==0:
9393
sound.play(globals.currentAccount,"boundary")
94-
if globals.prefs.repeat==True:
94+
if globals.prefs.repeat:
9595
self.speak_item()
9696
return
9797
globals.currentAccount.currentTimeline.index-=1
9898
self.focus_tl_item()
9999

100100
def prev_item_jump(self):
101-
if globals.currentAccount.currentTimeline.index<20:
101+
if globals.currentAccount.currentTimeline.index < globals.prefs.move_amount:
102102
sound.play(globals.currentAccount,"boundary")
103-
if globals.prefs.repeat==True:
103+
if globals.prefs.repeat:
104104
self.speak_item()
105105
return
106-
globals.currentAccount.currentTimeline.index-=20
106+
globals.currentAccount.currentTimeline.index -= globals.prefs.move_amount
107107
self.focus_tl_item()
108108

109109
def top_item(self):
@@ -113,19 +113,19 @@ def top_item(self):
113113
def next_item(self):
114114
if globals.currentAccount.currentTimeline.index==len(globals.currentAccount.currentTimeline.statuses)-1 or len(globals.currentAccount.currentTimeline.statuses)==0:
115115
sound.play(globals.currentAccount,"boundary")
116-
if globals.prefs.repeat==True:
116+
if globals.prefs.repeat:
117117
self.speak_item()
118118
return
119119
globals.currentAccount.currentTimeline.index+=1
120120
self.focus_tl_item()
121121

122122
def next_item_jump(self):
123-
if globals.currentAccount.currentTimeline.index>=len(globals.currentAccount.currentTimeline.statuses)-20:
123+
if globals.currentAccount.currentTimeline.index >= len(globals.currentAccount.currentTimeline.statuses) - globals.prefs.move_amount:
124124
sound.play(globals.currentAccount,"boundary")
125-
if globals.prefs.repeat==True:
125+
if globals.prefs.repeat:
126126
self.speak_item()
127127
return
128-
globals.currentAccount.currentTimeline.index+=20
128+
globals.currentAccount.currentTimeline.index += globals.prefs.move_amount
129129
self.focus_tl_item()
130130

131131
def bottom_item(self):

GUI/lists.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self,account,user=None,add=True):
2020
self.list.Bind(wx.EVT_LISTBOX, self.on_list_change)
2121
self.add_items()
2222
if self.user!=None:
23-
if self.add==True:
23+
if self.add:
2424
self.load = wx.Button(self.panel, wx.ID_DEFAULT, "&Add")
2525
else:
2626
self.load = wx.Button(self.panel, wx.ID_DEFAULT, "&Remove")
@@ -120,7 +120,7 @@ def Load(self, event):
120120
if self.user==None:
121121
misc.list_timeline(self.account,self.lists[self.list.GetSelection()].name, self.lists[self.list.GetSelection()].id)
122122
else:
123-
if self.add==True:
123+
if self.add:
124124
self.account.api.add_list_member(user_id=self.user.id, list_id=self.lists[self.list.GetSelection()].id)
125125
else:
126126
self.account.api.remove_list_member(user_id=self.user.id, list_id=self.lists[self.list.GetSelection()].id)

GUI/main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,14 @@ def unregister_keys(self):
272272
success=invisible.register_key(key[0],key[1],False)
273273

274274
def ToggleWindow(self):
275-
if self.IsShown()==True:
275+
if self.IsShown():
276276
self.Show(False)
277277
globals.prefs.window_shown=False
278278
else:
279279
self.Show(True)
280280
self.Raise()
281281
globals.prefs.window_shown=True
282-
if globals.prefs.invisible_sync==False:
282+
if not globals.prefs.invisible_sync:
283283
self.list.SetSelection(globals.currentAccount.currentIndex)
284284
self.on_list_change(None)
285285
self.list2.SetSelection(globals.currentAccount.currentTimeline.index)
@@ -339,13 +339,13 @@ def OnHide(self,event=None):
339339
globals.currentAccount.currentTimeline.hide_tl()
340340

341341
def OnNextInThread(self,event=None):
342-
if globals.prefs.reversed==False:
342+
if not globals.prefs.reversed:
343343
misc.next_in_thread(globals.currentAccount)
344344
else:
345345
misc.previous_in_thread(globals.currentAccount)
346346

347347
def OnPreviousInThread(self,event=None):
348-
if globals.prefs.reversed==False:
348+
if not globals.prefs.reversed:
349349
misc.previous_in_thread(globals.currentAccount)
350350
else:
351351
misc.next_in_thread(globals.currentAccount)
@@ -395,7 +395,7 @@ def refreshTimelines(self):
395395
def on_list_change(self, event):
396396
globals.currentAccount.currentTimeline=globals.currentAccount.list_timelines()[self.list.GetSelection()]
397397
globals.currentAccount.currentIndex=self.list.GetSelection()
398-
if globals.currentAccount.currentTimeline.removable==True:
398+
if globals.currentAccount.currentTimeline.removable:
399399
self.m_close_timeline.Enable(True)
400400
else:
401401
self.m_close_timeline.Enable(False)
@@ -404,7 +404,7 @@ def on_list_change(self, event):
404404
self.refreshList()
405405

406406
def play_earcon(self):
407-
if globals.prefs.earcon_top==True and (globals.prefs.reversed==False and globals.currentAccount.currentTimeline.index>0 or globals.prefs.reversed==True and globals.currentAccount.currentTimeline.index<len(globals.currentAccount.currentTimeline.statuses)-1):
407+
if globals.prefs.earcon_top and (not globals.prefs.reversed and globals.currentAccount.currentTimeline.index > 0 or globals.prefs.reversed and globals.currentAccount.currentTimeline.index < len(globals.currentAccount.currentTimeline.statuses) - 1):
408408
sound.play(globals.currentAccount,"new")
409409

410410
def OnFollowers(self,event=None):
@@ -447,7 +447,7 @@ def OnCleanUserDb(self, event=None):
447447

448448
def on_list2_change(self, event):
449449
globals.currentAccount.currentTimeline.index=self.list2.GetSelection()
450-
if globals.prefs.earcon_audio==True and len(sound.get_media_urls(utils.find_urls_in_tweet(globals.currentAccount.currentTimeline.statuses[globals.currentAccount.currentTimeline.index])))>0:
450+
if globals.prefs.earcon_audio and len(sound.get_media_urls(utils.find_urls_in_tweet(globals.currentAccount.currentTimeline.statuses[globals.currentAccount.currentTimeline.index]))) > 0:
451451
sound.play(globals.currentAccount,"media")
452452

453453
def onRefresh(self,event=None):
@@ -558,12 +558,12 @@ def OnUnmuteUser(self, event=None):
558558

559559
def OnCloseTimeline(self, event=None):
560560
tl=globals.currentAccount.currentTimeline
561-
if tl.removable==True:
562-
if globals.prefs.ask_dismiss==True:
561+
if tl.removable:
562+
if globals.prefs.ask_dismiss:
563563
dlg=wx.MessageDialog(None,"Are you sure you wish to close "+tl.name+"?","Warning",wx.YES_NO | wx.ICON_QUESTION)
564564
result=dlg.ShowModal()
565565
dlg.Destroy()
566-
if globals.prefs.ask_dismiss==False or globals.prefs.ask_dismiss==True and result== wx.ID_YES:
566+
if not globals.prefs.ask_dismiss or globals.prefs.ask_dismiss and result== wx.ID_YES:
567567
if tl.type=="user" and tl.data in globals.currentAccount.prefs.user_timelines:
568568
globals.currentAccount.prefs.user_timelines.remove(tl.data)
569569
if tl.type=="list" and tl.data in globals.currentAccount.prefs.list_timelines:

GUI/misc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,36 +193,36 @@ def havent_tweeted(account):
193193
flw.Show()
194194

195195
def user_timeline_user(account,username,focus=True):
196-
if username in account.prefs.user_timelines and focus==True:
196+
if username in account.prefs.user_timelines and focus:
197197
utils.alert("You already have a timeline for this user open.","Error")
198198
return False
199199
if len(account.prefs.user_timelines)>=8:
200200
utils.alert("You cannot have this many user timelines open! Please consider using a list instead.","Error")
201201
return False
202202
user=utils.lookup_user_name(account,username)
203203
if user!=-1:
204-
if focus==False:
204+
if not focus:
205205
account.timelines.append(timeline.timeline(account,name=username+"'s Timeline",type="user",data=username,user=user,silent=True))
206206
else:
207207
account.timelines.append(timeline.timeline(account,name=username+"'s Timeline",type="user",data=username,user=user))
208208
if username not in account.prefs.user_timelines:
209209
account.prefs.user_timelines.append(username)
210210
main.window.refreshTimelines()
211-
if focus==True:
211+
if focus:
212212
account.currentIndex=len(account.timelines)-1
213213
main.window.list.SetSelection(len(account.timelines)-1)
214214
main.window.on_list_change(None)
215215
return True
216216

217217
def search(account,q,focus=True):
218-
if focus==False:
218+
if not focus:
219219
account.timelines.append(timeline.timeline(account,name=q+" Search",type="search",data=q,silent=True))
220220
else:
221221
account.timelines.append(timeline.timeline(account,name=q+" Search",type="search",data=q))
222222
if q not in account.prefs.search_timelines:
223223
account.prefs.search_timelines.append(q)
224224
main.window.refreshTimelines()
225-
if focus==True:
225+
if focus:
226226
account.currentIndex=len(account.timelines)-1
227227
main.window.list.SetSelection(len(account.timelines)-1)
228228
main.window.on_list_change(None)
@@ -233,20 +233,20 @@ def user_search(account,q):
233233
u.Show()
234234

235235
def list_timeline(account,n, q,focus=True):
236-
if q in account.prefs.list_timelines and focus==True:
236+
if q in account.prefs.list_timelines and focus:
237237
utils.alert("You already have a timeline for this list open!","Error")
238238
return
239239
if len(account.prefs.list_timelines)>=8:
240240
utils.alert("You cannot have this many list timelines open!","Error")
241241
return
242-
if focus==False:
242+
if not focus:
243243
account.timelines.append(timeline.timeline(account,name=n+" List",type="list",data=q,silent=True))
244244
else:
245245
account.timelines.append(timeline.timeline(account,name=n+" List",type="list",data=q))
246246
if q not in account.prefs.list_timelines:
247247
account.prefs.list_timelines.append(q)
248248
main.window.refreshTimelines()
249-
if focus==True:
249+
if focus:
250250
account.currentIndex=len(account.timelines)-1
251251
main.window.list.SetSelection(len(account.timelines)-1)
252252
main.window.on_list_change(None)
@@ -324,7 +324,7 @@ def load_conversation(account,status):
324324
main.window.on_list_change(None)
325325

326326
def play(status):
327-
if sound.player!=None and sound.player.is_playing==True:
327+
if sound.player != None and sound.player.is_playing:
328328
speak.speak("Stopped")
329329
sound.stop()
330330
return

GUI/options.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ def __init__(self, parent):
3030
self.wrap=wx.CheckBox(self, -1, "Word wrap in text fields")
3131
self.main_box.Add(self.wrap, 0, wx.ALL, 10)
3232
self.wrap.SetValue(globals.prefs.wrap)
33+
self.move_amount_label = wx.StaticText(self, -1, "Number of tweets to move when using control+windows+page up/down")
34+
self.move_amount = wx.TextCtrl(self, -1, "")
35+
self.main_box.Add(self.move_amount, 0, wx.ALL, 10)
36+
self.move_amount.AppendText(str(globals.prefs.move_amount))
3337
self.autoOpenSingleURL=wx.CheckBox(self, -1, "when getting URLs from a tweet, automatically open the first URL if it is the only one")
3438
self.main_box.Add(self.autoOpenSingleURL, 0, wx.ALL, 10)
3539
self.autoOpenSingleURL.SetValue(globals.prefs.autoOpenSingleURL)
@@ -138,9 +142,9 @@ def OnOK(self, event):
138142
globals.prefs.invisible_sync=self.advanced.invisible_sync.GetValue()
139143
globals.prefs.repeat=self.advanced.repeat.GetValue()
140144
globals.prefs.invisible_sync=self.advanced.invisible_sync.GetValue()
141-
if globals.prefs.invisible==True and main.window.invisible==False:
145+
if globals.prefs.invisible and not main.window.invisible:
142146
main.window.register_keys()
143-
if globals.prefs.invisible==False and main.window.invisible==True:
147+
if not globals.prefs.invisible and main.window.invisible:
144148
main.window.unregister_keys()
145149
# globals.prefs.streaming=self.advanced.streaming.GetValue()
146150
globals.prefs.position=self.advanced.position.GetValue()
@@ -151,6 +155,11 @@ def OnOK(self, event):
151155
globals.prefs.update_time=int(self.advanced.update_time.GetValue())
152156
if globals.prefs.update_time<1:
153157
globals.prefs.update_time=1
158+
globals.prefs.move_amount = int(self.general.move_amount.GetValue())
159+
if globals.prefs.move_amount < 5:
160+
globals.prefs.move_amount = 5
161+
if globals.prefs.move_amount > 50:
162+
globals.prefs.move_amount = 50
154163
globals.prefs.user_limit=int(self.advanced.user_limit.GetValue())
155164
if globals.prefs.user_limit<1:
156165
globals.prefs.user_limit=1
@@ -176,9 +185,9 @@ def OnOK(self, event):
176185
globals.prefs.userTemplate=self.templates.userTemplate.GetValue()
177186
globals.prefs.autoOpenSingleURL=self.general.autoOpenSingleURL.GetValue()
178187
self.Destroy()
179-
if reverse==True:
188+
if reverse:
180189
timeline.reverse()
181-
if refresh==True:
190+
if refresh:
182191
main.window.refreshList()
183192

184193
def OnClose(self, event):

GUI/tray.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self, frame):
2020
def CreatePopupMenu(self):
2121
menu = wx.Menu()
2222
create_menu_item(menu, 'New tweet', self.frame.OnTweet)
23-
if self.frame.IsShown()==True:
23+
if self.frame.IsShown():
2424
create_menu_item(menu, 'Hide window', self.OnShowHide)
2525
else:
2626
create_menu_item(menu, 'Show window', self.OnShowHide)
@@ -35,7 +35,7 @@ def OnShowHide(self, event):
3535

3636
def on_exit(self, event, blah=True):
3737
self.Destroy()
38-
if blah==True:
38+
if blah:
3939
self.frame.OnClose(event)
4040

4141
def set_icon(self, path):

GUI/tweet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def onKeyPress(self,event):
8989
mods = event.HasAnyModifiers()
9090
keycode = event.GetKeyCode()
9191
if keycode == wx.WXK_RETURN:
92-
if mods==False:
92+
if not mods:
9393
self.Tweet(None)
9494
event.Skip()
9595

@@ -180,7 +180,7 @@ def Tweet(self, event):
180180
index=0
181181
if hasattr(self,"list"):
182182
for i in self.users:
183-
if self.list.IsChecked(index)==False:
183+
if not self.list.IsChecked(index):
184184
self.ids.append(str(i.id))
185185
index+=1
186186
status=self.account.tweet(self.text.GetValue(),self.status.id,auto_populate_reply_metadata=True,exclude_reply_user_ids=",".join(self.ids))
@@ -211,7 +211,7 @@ def Tweet(self, event):
211211
snd="send_message"
212212
if status!=False:
213213
sound.play(self.account,snd)
214-
if hasattr(self,"thread")==True and self.thread.GetValue()==False or hasattr(self,"thread")==False:
214+
if hasattr(self,"thread") and not self.thread.GetValue() or not hasattr(self, "thread"):
215215
self.Destroy()
216216
else:
217217
self.status=status

0 commit comments

Comments
 (0)