Skip to content

Commit

Permalink
Mediaplayer and peers UI changes
Browse files Browse the repository at this point in the history
* Peers UI: always show human DID service names

* Mediaplayer: add an action to pin an entire playlist

* Some changes in the config defaults

* Font changes in the moon3 theme
  • Loading branch information
cipres authored and cipres committed Feb 16, 2021
1 parent 94da53c commit 81a5147
Show file tree
Hide file tree
Showing 27 changed files with 441 additions and 293 deletions.
4 changes: 2 additions & 2 deletions galacteek/browser/webprofiles/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ envs:
fonts:
standard: 'Inter UI'
fixed: 'Inter UI'
serif: 'Inter UI'
sansSerif: 'Inter UI'
serif: 'Verdana'
sansSerif: 'Verdana'
1 change: 0 additions & 1 deletion galacteek/core/profile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ async def ipIdentifierInit(self, ipfsop, ipid: IPIdentifier):
}, publish=False)

await ipid.addServiceCollection('default')
await ipid.addServiceRendezVous()

entry = await self.ctx.app.importQtResource('/share/icons/helmet.png')

Expand Down
2 changes: 1 addition & 1 deletion galacteek/ipfs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ envs:
default:
search:
ipfsSearch:
pageResultsTimeout: 12.0
pageResultsTimeout: 15.0
getMetadataTimeout: 10.0

unixfs:
Expand Down
4 changes: 2 additions & 2 deletions galacteek/ipfs/ipfsops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1499,7 +1499,7 @@ async def addJson(self, obj, cidversion=1, **kw):
self.debug(err.message)
return None

async def getJson(self, cid, timeout=5):
async def getJson(self, cid, timeout=30):
try:
data = await self.catObject(cid, timeout=timeout)
return orjson.loads(data.decode())
Expand Down Expand Up @@ -1726,7 +1726,7 @@ async def dagPutOffline(self, data, pin=False):
"""
return await self.dagPut(data, pin=pin, offline=True)

async def dagGet(self, dagPath, timeout=10):
async def dagGet(self, dagPath, timeout=30):
"""
Get the DAG object referenced by the DAG path and returns a JSON object
"""
Expand Down
8 changes: 4 additions & 4 deletions galacteek/ipfs/ipfsops/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ envs:
unknown:
maxCacheLifetime: 600
ipidmanager:
maxCacheLifetime: 1800
maxCacheLifetime: 3600

ops:
# nameResolveStream (streamed resolve)
Expand All @@ -21,7 +21,7 @@ envs:

# nameResolveStreamFirst (streamed resolve, first)
nameResolveStreamFirst:
timeout: 10
timeout: 15
recordCount: 2
maxCacheLifetime: 600

Expand All @@ -40,11 +40,11 @@ envs:
timeout: 5

nameResolve:
timeout: 20
timeout: 30
recursive: False

catObject:
timeout: 60

listObject:
timeout: 60
timeout: 90
6 changes: 3 additions & 3 deletions galacteek/ipfs/pubsub/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ envs:
base:
throttler:
name: 'ps-throttler'
rateLimit: 60
rateLimit: 180
period: 30.0
retryInterval: 0.08

Expand All @@ -14,7 +14,7 @@ envs:
enabled: True

messageSize:
max: 32768
max: 65535

timeStampDiff:
min: 0.0
Expand All @@ -23,7 +23,7 @@ envs:
json:
filters:
messageSize:
max: 16384
max: 32768

rsaEncJson:
filters:
Expand Down
5 changes: 3 additions & 2 deletions galacteek/ipfs/pubsub/srvs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ envs:

throttler:
name: 'ps-peers-throttler'
rateLimit: 300
rateLimit: 400
period: 30.0
retryInterval: 0.15

Expand All @@ -28,8 +28,9 @@ envs:

UserChannelsListMessage:
# JWS fetch timeout in seconds
jwsFetchTimeout: 10
jwsFetchTimeout: 20

# How often we publish our pubchat tokens (in seconds)
publishTimer: 12

throttler:
Expand Down
6 changes: 6 additions & 0 deletions galacteek/templates/usersite/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ a:visited {
margin: 10px;
}

.blog-posts-bytag {
margin: 10px;
background-color: #2e7690;
padding: 20px;
}

pre {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
Expand Down
2 changes: 1 addition & 1 deletion galacteek/templates/usersite/bytag.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% extends "usersite/layout.html" %}
{% block body %}

<div class="blog-posts">
<div class="blog-posts-bytag">
<p>Posts with tag <b>{{ tag }}</b></p>
<ul>
{% for post in tagposts %}
Expand Down
12 changes: 6 additions & 6 deletions galacteek/ui/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ async def onJoinChannel(self, ipfsop, channel):
widget = await self.chans.joinChannel(channel)
self.app.mainWindow.registerTab(
widget, name=channel,
icon=getIcon('qta:mdi.chat-outline'),
icon=getIcon('chat.png'),
current=True,
workspace=WS_PEERS
)
Expand Down Expand Up @@ -354,7 +354,7 @@ def __init__(self, *args, **kw):

self.app = QApplication.instance()
self.menu.addAction(
getIcon('qta:mdi.chat'),
getIcon('chat.png'),
'Create public channel',
self.onCreateChannel
)
Expand All @@ -369,7 +369,7 @@ def __init__(self, *args, **kw):
self.menu.addSeparator()

self.menu.addAction(
getIcon('qta:mdi.chat'),
getIcon('chat.png'),
'Join channel',
self.onJoinChannelFromList
)
Expand All @@ -386,7 +386,7 @@ async def onShowChannels(self, ipfsop):

for channel in dagChannels.channels:
self.chanMenu.addAction(
getIcon('qta:mdi.chat'),
getIcon('chat.png'),
channel, partialEnsure(
self.chans.onJoinChannel,
channel
Expand Down Expand Up @@ -530,7 +530,7 @@ def focusMessage(self):
self.ui.message.setFocus(Qt.OtherFocusReason)

async def onTabChanged(self):
self.setTabIcon(getIcon('qta:mdi.chat-outline'))
self.setTabIcon(getIcon('chat.png'))

async def participantsHandles(self):
return [p['handle'] for p in await self.participantsData()]
Expand Down Expand Up @@ -671,7 +671,7 @@ async def onChatMessageReceived(self, ipfsop, key, hubMessage):
self.setTabIcon(getIcon('chat-active.png'))
self.tabActiveNotify()
else:
self.setTabIcon(getIcon('qta:mdi.chat-outline'))
self.setTabIcon(getIcon('chat.png'))

# System tray notification if the main window is not visible
if not self.app.mainWindow.isActiveWindow():
Expand Down
2 changes: 1 addition & 1 deletion galacteek/ui/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ envs:
desktopGeneric:
# Pixel metrics
metrics:
toolBarIconSize: 32
toolBarIconSize: 24
toolBarItemSpacing: 2
toolBarItemMargin: 0
toolBarSeparatorExtent: 2
Expand Down
2 changes: 1 addition & 1 deletion galacteek/ui/dwebspace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ async def event_g_services_bitmessage(self, key, message):
self.wsSwitchButton.setEnabled(True)

async def event_g_42(self, key, message):
if message['event'] == 'bmComposeRequest':
if self.msger.bmReady and message['event'] == 'bmComposeRequest':
self.wsSwitch()

self.msger.composeMessage(
Expand Down
9 changes: 8 additions & 1 deletion galacteek/ui/forms/mediaplaylist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QListView" name="listView"/>
<widget class="QListView" name="listView">
<property name="font">
<font>
<family>Helvetica</family>
<pointsize>18</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</item>
Expand Down
8 changes: 7 additions & 1 deletion galacteek/ui/forms/settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
<x>0</x>
<y>0</y>
<width>836</width>
<height>530</height>
<height>693</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>600</height>
</size>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
Expand Down
76 changes: 68 additions & 8 deletions galacteek/ui/mediaplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,47 @@ def iPlaylistRemoveMedia():
'Remove media from playlist')


def iPlaylist():
return QCoreApplication.translate(
'MediaPlayer',
'Playlist'
)


def iPlaylistName():
return QCoreApplication.translate(
'MediaPlayer',
'Playlist name')


def iPlaylistPinItems():
return QCoreApplication.translate(
'MediaPlayer',
'Pin playlist items'
)


def iPlaylistClear():
return QCoreApplication.translate(
'MediaPlayer',
'Clear playlist'
)


def iPlaylistSave():
return QCoreApplication.translate(
'MediaPlayer',
'Save playlist'
)


def iPlaylistLoad():
return QCoreApplication.translate(
'MediaPlayer',
'Load playlist'
)


def iAlreadyInPlaylist():
return QCoreApplication.translate('MediaPlayer',
'Already queued in the current playlist')
Expand Down Expand Up @@ -218,12 +253,17 @@ def __init__(self, gWindow):
self.model = ListModel(self.playlist)

self.pMenu = QMenu(self)
self.playlistsMenu = QMenu('Load playlist', self.pMenu)
self.playlistsMenu = QMenu(iPlaylistLoad(), self.pMenu)

self.savePlaylistAction = QAction(getIcon('save-file.png'),
'Save playlist', self,
iPlaylistSave(), self,
triggered=self.onSavePlaylist)
self.clearPlaylistAction = QAction('Clear', self,
self.pinPlaylistAction = QAction(getIcon('pin.png'),
iPlaylistPinItems(), self,
triggered=partialEnsure(
self.onPinPlaylistMedia))
self.clearPlaylistAction = QAction(getIcon('clear-all.png'),
iPlaylistClear(), self,
triggered=self.onClearPlaylist)
self.savePlaylistAction.setEnabled(False)
self.copyPathAction = QAction(getIconIpfsIce(),
Expand All @@ -238,6 +278,8 @@ def __init__(self, gWindow):
self.pMenu.addSeparator()
self.pMenu.addAction(self.savePlaylistAction)
self.pMenu.addSeparator()
self.pMenu.addAction(self.pinPlaylistAction)
self.pMenu.addSeparator()

self.pMenu.addAction(self.copyPathAction)
self.pMenu.addSeparator()
Expand Down Expand Up @@ -297,7 +339,7 @@ def __init__(self, gWindow):

self.togglePList = GLargeToolButton(parent=self)
self.togglePList.setIcon(getIcon('playlist.png'))
self.togglePList.setText('Playlist')
self.togglePList.setText(iPlaylist())
self.togglePList.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
self.togglePList.setCheckable(True)
self.togglePList.toggled.connect(self.onTogglePlaylist)
Expand Down Expand Up @@ -365,6 +407,14 @@ def __init__(self, gWindow):
def clipboardButton(self):
return self.uipList.queueFromClipboard

@property
def mediaCount(self):
return self.playlist.mediaCount()

@property
def playlistEmpty(self):
return self.mediaCount == 0

@property
def isPlaying(self):
return self.playerState == self.statePlaying
Expand All @@ -382,6 +432,7 @@ def useUpdates(self, updates=True):
self.videoWidget.setUpdatesEnabled(updates)

def update(self):
self.refreshActions()
self.app.task(self.updatePlaylistsMenu)

def onFullScreen(self):
Expand Down Expand Up @@ -532,9 +583,18 @@ async def loadPlaylistFromPath(self, ipfsop, path):
except Exception:
return messageBox(iCannotLoadPlaylist())

@ipfsOp
async def onPinPlaylistMedia(self, ipfsop, *args):
"""
Pin each media in the playlist
"""
for path in self.playlistGetPaths():
await ipfsop.ctx.pin(
path, recursive=False, qname='mediaplayer')

def refreshActions(self):
self.savePlaylistAction.setEnabled(
self.playlist.mediaCount() > 0)
self.pinPlaylistAction.setEnabled(not self.playlistEmpty)
self.savePlaylistAction.setEnabled(not self.playlistEmpty)

def playlistMediaInserted(self, start, end):
self.refreshActions()
Expand All @@ -549,7 +609,7 @@ def playlistGetPaths(self):

def playlistGetUrls(self):
urls = []
for idx in range(0, self.playlist.mediaCount()):
for idx in range(0, self.mediaCount):
media = self.playlist.media(idx)
urls.append(media.canonicalUrl())
return urls
Expand Down Expand Up @@ -622,7 +682,7 @@ def onSeek(self, seconds):
self.player.setPosition(seconds * 1000)

def showEvent(self, event):
if self.playlist.mediaCount() == 0:
if self.playlistEmpty:
self.togglePList.setChecked(True)

super().showEvent(event)
Expand Down
Loading

0 comments on commit 81a5147

Please sign in to comment.